Overview
Introduction
Ever received a file called "photo.jpg" and wondered if it's actually a JPEG? This tool checks the file's real bytes and tells you, instantly.
Everything runs locally in your browser; the file you check is never uploaded anywhere.
What Is JPG Checker?
A structural file-format checker that reads a file's opening bytes and compares them against the standard 3-byte JPEG signature (FF D8 FF), independent of the file's name or extension.
When the signature matches, it also reports the image's pixel dimensions using the browser's built-in image decoder.
How JPG Checker Works
The uploaded file is read as raw bytes, and the first 3 bytes are compared directly against the JPEG Start of Image marker.
If they match, the tool separately asks the browser to decode the file as an image via createImageBitmap and reports the resulting width and height; if decoding fails despite a matching signature, dimensions are simply omitted rather than reported incorrectly.
When To Use JPG Checker
Use it whenever you've received a file with a .jpg or .jpeg extension from an untrusted or automated source and want to confirm it's genuinely a JPEG before processing it further.
It's also useful for quickly sanity-checking a batch of files exported from another tool that might have mislabeled some formats.
Often used alongside JPG to Hex Converter, JPG to Data URI Converter and JPG to RGB Values Converter.
Features
Advantages
- Checks the file's actual bytes rather than trusting its name or extension.
- Works on any file, not just ones already named with a JPEG extension.
- Runs entirely client-side; the file you check is never uploaded to a server.
Limitations
- Only the file's opening bytes are checked; a file that starts correctly but is truncated or corrupted further in may still report 'yes'.
- Dimensions are only available when the browser's own decoder can successfully open the file, which can occasionally fail even for a file with a technically valid header.
Examples
Best Practices & Notes
Best Practices
- Use this before feeding an untrusted upload into a strict image pipeline that assumes a specific format.
- Combine with the file's reported dimensions as a second sanity check that decoding genuinely succeeded.
Developer Notes
checkJpgSignature is a pure, DOM-free function over a Uint8Array; the optional dimensions lookup happens separately in the component via createImageBitmap, since that browser API isn't available in a plain Node test environment.
JPG Checker Use Cases
- Validating a batch of user-uploaded files before running them through a JPEG-specific pipeline
- Confirming an automated export script actually produced real JPEGs and not mislabeled files
- Quickly checking a suspicious or unfamiliar file's true format
Common Mistakes
- Assuming a passing signature check means the entire file is undamaged; it only confirms the header.
- Relying on a file's extension instead of running an actual byte check when format correctness matters.
Tips
- If a file fails this check unexpectedly, try opening it in an image viewer to see what format it actually is.
- Pair with the JPG to Hex Converter if you want to inspect the exact header bytes yourself.