Generic JPEG Image fileTrailer:FF D9 (.jpeg)
.jpeg file signature | image/jpeg
JPEGraw or in theJFIForExiffile format[17]
Magic Bytes
Offset 0
FF D8 FF
Sources: Apache Tika
All Known Signatures
4 signature variants are documented for .jpeg files across multiple sources.
| Hex Signature | Offset | Sources |
|---|---|---|
| FF D8 FF | 0 | Apache Tika |
| FF D8 FF DB | 0 | Wikipedia |
| FF D8 | 0 | Gary Kessler |
| FF D8 FF E0 4A 46 49 46 00 | 0 | Gary Kessler |
Extension
.jpeg
MIME Type
image/jpeg
Byte Offset
0
Risk Level
Safe
Validation Code
How to validate .jpeg files in Python
def is_jpeg(file_path: str) -> bool:
"""Check if file is a valid JPEG by magic bytes."""
signature = bytes([0xFF, 0xD8, 0xFF])
with open(file_path, "rb") as f:
return f.read(3) == signature
How to validate .jpeg files in Node.js
function isJPEG(buffer: Buffer): boolean {
const signature = Buffer.from([0xFF, 0xD8, 0xFF]);
return buffer.subarray(0, 3).equals(signature);
}
How to validate .jpeg files in Go
func IsJPEG(data []byte) bool {
signature := []byte{0xFF, 0xD8, 0xFF}
if len(data) < 3 {
return false
}
return bytes.Equal(data[:3], signature)
}
API Endpoint
/api/v1/jpeg
curl https://filesignature.org/api/v1/jpeg
See the full API documentation for all endpoints and parameters.
Frequently Asked Questions
What is a .jpeg file?
A .jpeg file is a Generic JPEG Image fileTrailer:FF D9 file. JPEGraw or in theJFIForExiffile format[17]
What are the magic bytes for .jpeg files?
The magic bytes for Generic JPEG Image fileTrailer:FF D9 files are FF D8 FF at byte offset 0. These bytes uniquely identify the file format regardless of the file extension.
How do I validate a .jpeg file?
To validate a .jpeg file, read the first bytes of the file and compare them against the known magic bytes (FF D8 FF) at offset 0. This is more reliable than checking the file extension alone, as extensions can be renamed.
What is the MIME type for .jpeg files?
The primary MIME type for .jpeg files is image/jpeg.
Is it safe to open .jpeg files?
Generic JPEG Image fileTrailer:FF D9 (.jpeg) 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.