Binary glTF is a 3d format commonly identified by .glb. Use the listed signatures, MIME types, and structure notes to validate files beyond the extension.
Do not trust the extension alone. Check the MIME type, the first bytes such as 67 6C 54 46, and format-specific structure when possible.
Container formats and damaged files can share the same opening bytes, so deeper validation may be required for production upload, preview, or conversion flows.
Detection example
SIGNATURE = bytes.fromhex("676c5446")
OFFSET = 0
def is_glb(path: str) -> bool:
with open(path, "rb") as f:
f.seek(OFFSET)
head = f.read(len(SIGNATURE))
return head == SIGNATURE
const SIGNATURE = [0x67, 0x6c, 0x54, 0x46];
const OFFSET = 0;
// bytes: a Uint8Array / Buffer holding the start of the file
export function isGlb(bytes) {
return SIGNATURE.every((byte, i) => bytes[OFFSET + i] === byte);
}
package fileid
import "bytes"
var isglbSignature = []byte{0x67, 0x6c, 0x54, 0x46}
const isglbOffset = 0
func IsGlb(b []byte) bool {
end := isglbOffset + len(isglbSignature)
if len(b) < end {
return false
}
return bytes.Equal(b[isglbOffset:end], isglbSignature)
}
Binary glTF is used in 3D viewers, asset pipelines, model conversion, avatar loading, and scene validation. Containers, extensions, binary chunks, and texture references all affect implementation behavior.
Common detection mistakes
The .glb extension alone does not prove the file contents. Upload and conversion flows should combine extension, MIME type, leading bytes, and format-specific structure checks.
Binary glTF can start with signatures such as 67 6C 54 46, but related containers and damaged files may require additional validation.
Security notes
Untrusted input is not safe just because the format was detected. Account for parser exceptions, large files, unexpected encodings, and external references.
Using samples
11 samples help test viewer loading, extension detection, and load time across file sizes.
Box Vertex Colors GLB is a Binary glTF sample based on Khronos glTF Sample Assets. It can be used to test downloads, parsers, previews, and file type detection.
Animated Colors Cube GLB is a Binary glTF sample based on Khronos glTF Sample Assets. It can be used to test downloads, parsers, previews, and file type detection.
Animated Morph Cube GLB is a Binary glTF sample based on Khronos glTF Sample Assets. It can be used to test downloads, parsers, previews, and file type detection.
Simple Instancing GLB is a Binary glTF sample based on Khronos glTF Sample Assets. It can be used to test downloads, parsers, previews, and file type detection.
Metal Rough Spheres GLB is a Binary glTF sample based on Khronos glTF Sample Assets. It can be used to test downloads, parsers, previews, and file type detection.
Glass Vase Flowers GLB is a Binary glTF sample based on Khronos glTF Sample Assets. It can be used to test downloads, parsers, previews, and file type detection.
Clearcoat Wicker GLB is a Binary glTF sample based on Khronos glTF Sample Assets. It can be used to test downloads, parsers, previews, and file type detection.
Water Bottle GLB is a Binary glTF sample based on Khronos glTF Sample Assets. It can be used to test downloads, parsers, previews, and file type detection.
What is the magic number (file signature) of Binary glTF?
Binary glTF files begin with the byte signature 67 6C 54 46 ("glTF"). Detect the format by reading these leading bytes rather than trusting the file extension alone.
What is the MIME type of Binary glTF?
The MIME type for Binary glTF is model/gltf-binary, model/gltf+binary.
What file extension does Binary glTF use?
Binary glTF files use the .glb extension. The extension is a convention only and does not guarantee the file contents, so combine it with signature and structure checks.