XML (.xml)
.xml file signature | application/xml
eXtensible Markup Language[29][66]
Magic Bytes
Offset 0
3C 3F 78 6D 6C
Sources: Apache Tika
All Known Signatures
7 signature variants are documented for .xml files across multiple sources.
| Hex Signature | Offset | Sources |
|---|---|---|
| 3C 3F 78 6D 6C | 0 | Apache Tika |
| 3C 3F 58 4D 4C | 0 | Apache Tika |
| EF BB BF 3C 3F 78 6D 6C | 0 | Apache Tika |
| FF FE 3C 00 3F 00 78 00 6D 00 6C 00 | 0 | Apache Tika |
| FE FF 00 3C 00 3F 00 78 00 6D 00 6C | 0 | Apache Tika |
| 3C 21 2D 2D | 0 | Apache Tika |
| 3C 3F 78 6D 6C 20 | 0 | Wikipedia |
Extension
.xml
MIME Type
application/xml
Byte Offset
0
Risk Level
Safe
Validation Code
How to validate .xml files in Python
def is_xml(file_path: str) -> bool:
"""Check if file is a valid XML by magic bytes."""
signature = bytes([0x3C, 0x3F, 0x78, 0x6D, 0x6C])
with open(file_path, "rb") as f:
return f.read(5) == signature
How to validate .xml files in Node.js
function isXML(buffer: Buffer): boolean {
const signature = Buffer.from([0x3C, 0x3F, 0x78, 0x6D, 0x6C]);
return buffer.subarray(0, 5).equals(signature);
}
How to validate .xml files in Go
func IsXML(data []byte) bool {
signature := []byte{0x3C, 0x3F, 0x78, 0x6D, 0x6C}
if len(data) < 5 {
return false
}
return bytes.Equal(data[:5], signature)
}
API Endpoint
/api/v1/xml
curl https://filesignature.org/api/v1/xml
See the full API documentation for all endpoints and parameters.
Frequently Asked Questions
What is a .xml file?
A .xml file is a XML file. eXtensible Markup Language[29][66]
What are the magic bytes for .xml files?
The magic bytes for XML files are 3C 3F 78 6D 6C at byte offset 0. These bytes uniquely identify the file format regardless of the file extension.
How do I validate a .xml file?
To validate a .xml file, read the first bytes of the file and compare them against the known magic bytes (3C 3F 78 6D 6C) at offset 0. This is more reliable than checking the file extension alone, as extensions can be renamed.
What is the MIME type for .xml files?
The primary MIME type for .xml files is application/xml.
Is it safe to open .xml files?
XML (.xml) 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.