Skip to content

HTM (.htm)

.htm file signature | text/html

Safe

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 .htm 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

.htm

MIME Type

text/html

Byte Offset

0

Risk Level

Safe

Validation Code

How to validate .htm files in Python

Python
def is_htm(file_path: str) -> bool:
    """Check if file is a valid HTM 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 .htm files in Node.js

Node.js
function isHTM(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 .htm files in Go

Go
func IsHTM(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

GET /api/v1/htm
curl https://filesignature.org/api/v1/htm

See the full API documentation for all endpoints and parameters.

Frequently Asked Questions

What is a .htm file?

A .htm file is a HTM file.

What are the magic bytes for .htm files?

The magic bytes for HTM 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 .htm file?

To validate a .htm 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 .htm files?

The primary MIME type for .htm files is text/html.

Is it safe to open .htm files?

HTM (.htm) 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.