HTML (.html)
.html file signature | text/html
Magic Bytes
Offset 0
3C 21 44 4F 43 54 59 50 45 20 48 54 4D 4C
Sources: Apache Tika
All Known Signatures
11 signature variants are documented for .html files across multiple sources.
| Hex Signature | Offset | Sources |
|---|---|---|
| 3C 21 44 4F 43 54 59 50 45 20 48 54 4D 4C | 0 | Apache Tika |
| 3C 21 44 4F 43 54 59 50 45 20 68 74 6D 6C | 0 | Apache Tika |
| 3C 21 64 6F 63 74 79 70 65 20 48 54 4D 4C | 0 | Apache Tika |
| 3C 21 64 6F 63 74 79 70 65 20 68 74 6D 6C | 0 | Apache Tika |
| 3C 48 45 41 44 | 0 | Apache Tika |
| 3C 68 65 61 64 | 0 | Apache Tika |
| 3C 54 49 54 4C 45 | 0 | Apache Tika |
| 3C 74 69 74 6C 65 | 0 | Apache Tika |
| 3C 48 54 4D 4C | 0 | Apache Tika |
| 3C 68 74 6D 6C | 0 | Apache Tika |
| 3C 68 74 6D 6C | 128 | Apache Tika |
Extension
.html
MIME Type
text/html
Byte Offset
0
Risk Level
Safe
Validation Code
How to validate .html files in Python
def is_html(file_path: str) -> bool:
"""Check if file is a valid HTML by magic bytes."""
signature = bytes([0x3C, 0x21, 0x44, 0x4F, 0x43, 0x54, 0x59, 0x50, 0x45, 0x20, 0x48, 0x54, 0x4D, 0x4C])
with open(file_path, "rb") as f:
return f.read(14) == signature
How to validate .html files in Node.js
function isHTML(buffer: Buffer): boolean {
const signature = Buffer.from([0x3C, 0x21, 0x44, 0x4F, 0x43, 0x54, 0x59, 0x50, 0x45, 0x20, 0x48, 0x54, 0x4D, 0x4C]);
return buffer.subarray(0, 14).equals(signature);
}
How to validate .html files in Go
func IsHTML(data []byte) bool {
signature := []byte{0x3C, 0x21, 0x44, 0x4F, 0x43, 0x54, 0x59, 0x50, 0x45, 0x20, 0x48, 0x54, 0x4D, 0x4C}
if len(data) < 14 {
return false
}
return bytes.Equal(data[:14], signature)
}
API Endpoint
/api/v1/html
curl https://filesignature.org/api/v1/html
See the full API documentation for all endpoints and parameters.
Frequently Asked Questions
What is a .html file?
A .html file is a HTML file.
What are the magic bytes for .html files?
The magic bytes for HTML files are 3C 21 44 4F 43 54 59 50 45 20 48 54 4D 4C at byte offset 0. These bytes uniquely identify the file format regardless of the file extension.
How do I validate a .html file?
To validate a .html file, read the first bytes of the file and compare them against the known magic bytes (3C 21 44 4F 43 54 59 50 45 20 48 54 4D 4C) at offset 0. This is more reliable than checking the file extension alone, as extensions can be renamed.
What is the MIME type for .html files?
The primary MIME type for .html files is text/html.
Is it safe to open .html files?
HTML (.html) files are generally safe to open. They are classified as low risk because they primarily contain data rather than executable code. However, always ensure files come from a trusted source.