TEX magic bytes (.tex)
.tex file signature: 5C 69 6E 70 75 74 | application/x-tex
TeX is a document preparation and typesetting language developed by Donald E. Knuth and maintained through the wider TeX community. It is used to produce scientific papers, books, technical reports, and documents containing complex mathematical notation, with applications such as LaTeX workflows and academic publishing. TeX files are generally safe as plain text, though malformed input can cause formatting issues during compilation.
Magic Bytes
Offset 0
5C 69 6E 70 75 74
Sources: Apache Tika
All Known Signatures
8 signature variants are documented for .tex files across multiple sources.
| Hex Signature | Offset | Sources |
|---|---|---|
| 5C 69 6E 70 75 74 | 0 | Apache Tika |
| 5C 73 65 63 74 69 6F 6E | 0 | Apache Tika |
| 5C 73 65 74 6C 65 6E 67 74 68 | 0 | Apache Tika |
| 5C 64 6F 63 75 6D 65 6E 74 73 74 79 6C 65 | 0 | Apache Tika |
| 5C 63 68 61 70 74 65 72 | 0 | Apache Tika |
| 5C 64 6F 63 75 6D 65 6E 74 63 6C 61 73 73 | 0 | Apache Tika |
| 5C 72 65 6C 61 78 | 0 | Apache Tika |
| 5C 63 6F 6E 74 65 6E 74 73 6C 69 6E 65 | 0 | Apache Tika |
Validation Code
How to validate .tex files in Python
def is_tex(file_path: str) -> bool:
"""Check if file is a valid TEX by magic bytes."""
signature = bytes([0x5C, 0x69, 0x6E, 0x70, 0x75, 0x74])
with open(file_path, "rb") as f:
return f.read(6) == signature
How to validate .tex files in Node.js
function isTEX(buffer: Buffer): boolean {
const signature = Buffer.from([0x5C, 0x69, 0x6E, 0x70, 0x75, 0x74]);
return buffer.subarray(0, 6).equals(signature);
}
How to validate .tex files in Go
func IsTEX(data []byte) bool {
signature := []byte{0x5C, 0x69, 0x6E, 0x70, 0x75, 0x74}
if len(data) < 6 {
return false
}
return bytes.Equal(data[:6], signature)
}
API Endpoint
/api/v1/tex
curl https://filesignature.org/api/v1/tex
See the full API documentation for all endpoints and parameters.
Related Formats
Frequently Asked Questions
What is a .tex file?
A .tex file is identified by the magic bytes 5C 69 6E 70 75 74 at byte offset 0. TeX is a document preparation and typesetting language developed by Donald E. Knuth and maintained through the wider TeX community. It is used to produce scientific papers, books, technical reports, and documents containing complex mathematical notation, with applications such as LaTeX workflows and academic publishing. TeX files are generally safe as plain text, though malformed input can cause formatting issues during compilation.
What are the magic bytes for .tex files?
The magic bytes for TEX (.tex) files are 5C 69 6E 70 75 74 at byte offset 0. These bytes identify the file format more reliably than the extension alone.
How do I validate a .tex file?
To validate a .tex file, read the first bytes of the file and compare them against the known magic bytes (5C 69 6E 70 75 74) at offset 0. This is more reliable than checking the file extension alone, as extensions can be renamed.
What is the MIME type for .tex files?
The primary MIME type for .tex files is application/x-tex.
Is it safe to open .tex files?
TEX (.tex) 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.