Web Open Font Format 2
application/octet-stream
Magic Bytes
Offset: 0
77 4F 46 32
Web Open Font Format 2 (WOFF2) is a font packaging format developed by Google and maintained by the World Wide Web Consortium (W3C). It is used to deliver typography across the internet, utilizing Brotli compression to reduce bandwidth usage and improve load times for web applications. As the current industry standard, it is considered safe because browsers and operating systems process these files within secure sandboxed environments to mitigate potential rendering vulnerabilities.
Validation Code
How to validate .woff2 files in Python
Python
def is_woff2(file_path: str) -> bool:
"""Check if file is a valid WOFF2 by magic bytes."""
signature = bytes([0x77, 0x4F, 0x46, 0x32])
with open(file_path, "rb") as f:
return f.read(4) == signature
How to validate .woff2 files in Node.js
Node.js
function isWOFF2(buffer: Buffer): boolean {
const signature = Buffer.from([0x77, 0x4F, 0x46, 0x32]);
return buffer.subarray(0, 4).equals(signature);
}
Go
func IsWOFF2(data []byte) bool {
signature := []byte{0x77, 0x4F, 0x46, 0x32}
if len(data) < 4 {
return false
}
return bytes.Equal(data[:4], signature)
}
API Endpoint
GET
/api/v1/woff2
curl https://filesignature.org/api/v1/woff2