Skip to content
Bytevive

How a JPEG tells you it isn't finished

Step through a sample JPEG's markers from SOI to EOI, then cut the file short or drop the end marker to see how decoders know a photo never finished saving.

By the Bytevive team2 min read

A diagram of JPEG markers in order: SOI, APP0, SOF0, SOS, scan data, and EOI

A JPEG is a sequence of markers, not a raw grid of pixels. Each marker is a short header declaring what the following bytes are. The compressed picture samples come later, coded from the top of the frame downward, and a decoder does not consider the file finished until it sees the end marker, EOI.

The diagram below is a simplified sample of that order: start of image, an application label, the frame header, the start of the scan, the coded scan data, and the end marker. Click a marker to read what it declares, or drag where the file ends and drop EOI. This page only checks whether the structure is finished; it does not decode pixels, and a truncated sample is not a repaired photo.

A 100-unit JPEG sample, not a real photo

Each block represents a marker, drawn wide enough to click. A real SOI or EOI is two bytes. Drag where the file ends, or drop EOI. No pixels are decoded.

scan is the marker the file cuts through. Coded scan data. A real viewer turns this into pixels; this diagram does not. If the file ends here, the rest of the picture was never saved.

File ends at 70. The scan marker is cut off: it runs to 92, past the end of the file. A decoder can tell the file did not finish. This page does not fill in missing bytes.

A photo that turns gray halfway down has usually lost the rest of the scan, including the end marker. The gray area is simply the viewer running out of data, not pixels that this page or any repair tool can honestly put back. Read the full guide on why a damaged JPEG turns gray from one line down, or our complete guide to fixing corrupted photos.

Photo won't open? Find out how much survived.

Free account, photos up to 256 MB. The picture never leaves your device.

Repair a photo, free

Other free tools: video, PDF, photo, Office, ZIP, and audio repair.