{
  "schemaVersion": "1.0",
  "canonicalPage": "https://fileformat.co/ext/glb",
  "inspectorUrl": "https://fileformat.co/inspect",
  "spec": {
    "slug": "glb",
    "extension": ".glb",
    "aliases": [],
    "name": "glTF 2.0 Binary 3D Asset",
    "shortName": "glTF GLB",
    "category": "media-3d",
    "tier": 1,
    "summary": "Khronos Group's single-file binary 3D delivery format combining a 12-byte header, a UTF-8 JSON scene-graph chunk (`0x4E4F534A`), and a raw GPU geometry/texture buffer (`0x004E4942`).",
    "technicalNotes": "Chunk 0 MUST be the JSON descriptor padded with `0x20` spaces to a 4-byte boundary; Chunk 1 (`BIN\\0`) is padded with `0x00` bytes.",
    "mimeTypes": [
      "model/gltf-binary"
    ],
    "identifiers": {
      "pronomPuid": "fmt/1316",
      "specUrl": "https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#glb-file-format-specification"
    },
    "binarySignature": {
      "endianness": "little",
      "magicBytes": [
        {
          "offset": 0,
          "hex": "67 6C 54 46 02 00 00 00",
          "ascii": "glTF....",
          "description": "'glTF' ASCII magic + uint32_le version 2"
        }
      ],
      "containerFamily": null,
      "headerLayout": [
        {
          "offset": "0x00 - 0x03",
          "byteOffset": 0,
          "byteLength": 4,
          "lengthLabel": "4 B",
          "dataType": "char[4]",
          "fieldName": "magic",
          "description": "ASCII 'glTF' (0x46546C67)"
        },
        {
          "offset": "0x04 - 0x07",
          "byteOffset": 4,
          "byteLength": 4,
          "lengthLabel": "4 B",
          "dataType": "uint32_le",
          "fieldName": "version",
          "description": "Container version (2)"
        },
        {
          "offset": "0x08 - 0x0B",
          "byteOffset": 8,
          "byteLength": 4,
          "lengthLabel": "4 B",
          "dataType": "uint32_le",
          "fieldName": "length",
          "description": "Total byte length of GLB file"
        },
        {
          "offset": "0x0C - 0x13",
          "byteOffset": 12,
          "byteLength": 8,
          "lengthLabel": "8 B",
          "dataType": "uint32_le[2]",
          "fieldName": "chunk0_hdr",
          "description": "JSON chunk length + type 0x4E4F534A ('JSON')"
        }
      ]
    },
    "securityProfile": {
      "riskLevel": "low",
      "allowsArbitraryCodeOrMacros": false,
      "xxeRisk": false,
      "polyglotPrependRisk": false,
      "pickleDeserializationRisk": false,
      "uploadValidationNotes": "Disallow external relative URI references inside glTF buffers/images when accepting untrusted .glb uploads on server-side renderers."
    },
    "codeSnippets": {
      "python": "import json, struct, sys\nwith open(sys.argv[1], \"rb\") as f:\n    magic, ver, total, c0_len, c0_type = struct.unpack(\"<4sIIII\", f.read(20))\n    assert magic == b\"glTF\" and c0_type == 0x4E4F534A\n    scene = json.loads(f.read(c0_len).decode(\"utf-8\"))\n    print(f\"GLB v{ver} ({total}B), nodes={len(scene.get('nodes', []))}\")",
      "typescript": "export async function readGlbJson(file: File) {\n  const hdr = new DataView(await file.slice(0, 20).arrayBuffer());\n  const c0Len = hdr.getUint32(12, true);\n  return JSON.parse(new TextDecoder().decode(await file.slice(20, 20 + c0Len).arrayBuffer()));\n}",
      "rust": "use std::{fs::File, io::Read};\nfn main() -> std::io::Result<()> {\n    let mut b = [0u8; 20];\n    File::open(std::env::args().nth(1).expect(\"usage: <prog> <file>\"))?.read_exact(&mut b)?;\n    println!(\"GLB total={}B\", u32::from_le_bytes(b[8..12].try_into().expect(\"fixed-size byte window\")));\n    Ok(())\n}",
      "go": "package main\nimport (\"encoding/binary\"; \"fmt\"; \"io\"; \"os\")\nfunc main() {\n    f, err := os.Open(os.Args[1])\n    if err != nil {\n        fmt.Fprintln(os.Stderr, \"open:\", err)\n        os.Exit(1)\n    }\n    defer f.Close()\n    b := make([]byte, 20)\n    if _, err := io.ReadFull(f, b); err != nil {\n        fmt.Fprintln(os.Stderr, \"read:\", err)\n        os.Exit(1)\n    }\n    fmt.Printf(\"GLB v%d len=%d\\n\", binary.LittleEndian.Uint32(b[4:8]), binary.LittleEndian.Uint32(b[8:12]))\n}"
    },
    "relatedFormats": [
      "usdz",
      "png",
      "webp"
    ],
    "verifiedAt": "2026-11-14T16:09:03Z"
  },
  "samples": [
    {
      "id": "glb-minimal",
      "filename": "minimal-triangle.glb",
      "variant": "minimal",
      "title": "Minimal glTF 2.0 Binary Scene (Single Triangle)",
      "description": "4-byte aligned binary glTF 2.0 (`67 6C 54 46`) with JSON scene graph chunk and 36-byte float32 vertex BIN chunk.",
      "localPath": "/fixtures/v1/glb/minimal-triangle.glb",
      "cdnUrl": "https://fileformat.co/fixtures/v1/glb/minimal-triangle.glb",
      "sizeBytes": 316,
      "sha256": "f9316dd27503e6edb7ab6cd653e6c920cd996cdd186c9cf0e829407a68ee5d8b",
      "expectValid": true
    },
    {
      "id": "glb-realistic",
      "filename": "pbr-scene-rig.glb",
      "variant": "realistic",
      "title": "Multi-Node PBR Scene Graph GLB",
      "description": "glTF 2.0 binary asset with CameraRig, KeyLight, ChassisMesh nodes and PBR material definition.",
      "localPath": "/fixtures/v1/glb/pbr-scene-rig.glb",
      "cdnUrl": "https://fileformat.co/fixtures/v1/glb/pbr-scene-rig.glb",
      "sizeBytes": 508,
      "sha256": "6d0c78f35cee7254d016f06a0fcc812b412655abf063a8ce98aafb1fcbe7b7e9",
      "expectValid": true
    },
    {
      "id": "glb-edge-case",
      "filename": "truncated-bin-chunk.glb",
      "variant": "edge-case",
      "title": "Truncated GLB Binary Geometry Chunk",
      "description": "GLB header `total_length` exceeds actual EOF by 16 bytes.",
      "localPath": "/fixtures/v1/glb/truncated-bin-chunk.glb",
      "cdnUrl": "https://fileformat.co/fixtures/v1/glb/truncated-bin-chunk.glb",
      "sizeBytes": 300,
      "sha256": "68a6984ac6eb610b64917f6a23ad957e2f5a6c692e2a2ccc0605d531d9302e65",
      "expectValid": false,
      "edgeCaseTag": "Truncated BIN Chunk"
    }
  ]
}