Skip to main content
Filesvo

Why Your Photo Looks Sideways: EXIF Orientation

Your photo is almost certainly not stored the way you see it. Cameras and phones save the sensor image as it was captured and add a single number — the EXIF orientation flag — telling viewers how far to turn it. Software that reads the flag shows it upright; software that reads only the pixels shows it on its side. To fix that for good, run the file through the tool below twice at 180°: the two turns cancel out, but the picture gets redrawn the right way up and saved with no flag left for anything to ignore. In a test, an 800 × 600 JPEG carrying orientation 6 came back as a 600 × 800 file, upright in its own pixels, with its entire EXIF block gone.

Rotate a photo and bake the orientation in

or drag and drop JPG/PNG/WebP files here — you can also paste from the clipboard

Processed on your device — files are never uploaded to Filesvo.

Eight files, one byte apart, showing eight different pictures

One 800 × 600 photograph was saved nine times: once with no orientation flag, and once for each of the eight values the flag can take. Every flagged file came out at exactly 167,713 bytes, and any two of them differ in exactly one byte — the value itself. The compressed picture inside them is identical.

Opened in a browser, those eight identical files display as eight different pictures. Four of them are landscape and four are portrait: values 5 to 8 make a browser swap the width and height, so the same 800 × 600 file becomes a 600 × 800 image on screen without a single pixel being rearranged in the file.

That is the whole problem in one sentence. The orientation is not part of the picture, it is a note attached to the picture, and a note can be lost, ignored or stripped while the picture stays exactly as it was.

The eight orientation values and what each one means

Checked in a browser rather than copied from a specification: one photograph with a differently coloured square in each corner was saved with each flag value, decoded, and the corner colours read back to see which way the picture had been turned. Values 5 to 8 swap the width and height.

ValueWhat a viewer that reads the flag does
1Nothing. The stored pixels are already the picture.
2Mirrors it left to right.
3Turns it 180°.
4Mirrors it top to bottom.
5Turns it 90° clockwise, then mirrors it left to right.
6Turns it 90° clockwise. The common one for a phone held upright.
7Turns it 90° anticlockwise, then mirrors it left to right.
8Turns it 90° anticlockwise.

Half of these mirror the picture as well as turning it. Values 2, 4, 5 and 7 produce a reflection, which is why a photo can come out the wrong way round rather than merely on its side.

Why the same file is upright in one app and sideways in the next

Nothing is broken when this happens. Two pieces of software are simply making different decisions about the same file, and both are defensible: one reads the metadata before drawing, the other draws what the compressed data actually contains.

The split is easy to demonstrate on one file. That 800 × 600 JPEG flagged with orientation 6 decodes to 600 × 800 in a browser, which reads the flag and turns the picture before handing it over. Pillow, a widely used Python image library, reports it as 800 × 600 and leaves it that way unless the code explicitly calls ImageOps.exif_transpose(). The macOS sips command reports 800 × 600 too, and file splits the difference, printing both the flag and the stored size: orientation=upper-right, 800x600.

So the answer to "which one is right" is that they all are. Anything that resizes, crops, re-encodes or thumbnails your photo without parsing EXIF first will produce an upright-looking file turned on its side, and by then the flag it discarded is gone.

Mirrored selfies: sometimes the flip is a flag too

Four of the eight values mirror the image, so a photo that looks reversed is not necessarily reversed in its pixels. Before reaching for the Flip Image tool, it is worth checking whether the file is carrying orientation 2, 4, 5 or 7 — because if it is, mirroring the pixels leaves the flag in place and the two cancel out in any viewer that reads it.

The image metadata viewer reads the flag out of the file without changing anything, which settles the question in one step. A value of 1, or no orientation tag at all, means what you see is genuinely what is stored, and a flip is the right fix.

Front-facing cameras muddy this further: many of them show a mirrored preview and then save the unmirrored picture, so the photo you took never matched the one on screen. That difference is in the pixels, not in the metadata, and no flag will explain it.

The permanent fix, and what it costs

Rotating by 180° twice sounds pointless and is exactly the point. Each pass decodes the file with the flag applied, draws the result into a fresh canvas and saves that — so two opposite turns leave the picture where it started while moving the orientation out of the metadata and into the pixels themselves. The end-to-end test: an 800 × 600 file flagged 6 went in, a 600 × 800 file came out with the picture upright and no orientation tag at all.

The cost is one JPEG re-encode, and the second pass is nearly free. Across six varied photographs, one pass changed the average pixel by 0.50 of a level out of 255 (a median 48.0 dB PSNR); a second pass took that to 0.52. Almost all of the loss happens the first time, because after one save at 92% quality the image already sits close to where the encoder would put it again.

File size is the surprise: the output is usually bigger, and by how much depends entirely on how the photo was saved before. The same photograph re-encoded at a range of qualities and rotated once grew by 132% from a quality-60 source, 82% from quality 75 and 40% from quality 85, changed by 0.6% from quality 92, and shrank by 25% from quality 95. The crossover sits at 92% because that is the quality the tool saves at — anything compressed harder than that gains bytes on the way back out.

Rotating deletes the metadata as well, GPS included

This is the trap that sends people to the Remove EXIF tool and back again: strip a photo's metadata and a photo that relied on its flag turns sideways, because the flag was metadata. Doing it in the other order avoids the problem entirely.

A rotation pass removes the metadata too, and not only the orientation. A test JPEG carrying a camera make and model, a timestamp and GPS coordinates went in with a 220-byte EXIF block; the rotated file had no EXIF marker at all, only a JFIF header and a 472-byte colour profile. The canvas the browser draws into knows nothing about the file it came from, so nothing survives the redraw.

That makes the order clear. If the photo has an orientation problem, rotate it — the metadata goes with it and the picture is fixed in one move. If it does not, use Remove EXIF instead, which edits the file container and leaves the compressed pixels untouched rather than re-encoding them.

Frequently asked questions

Why did my photo rotate after I removed its EXIF data?
Because the thing keeping it upright was EXIF. The camera stored the picture on its side and added an orientation flag telling viewers to turn it; removing the metadata removed the instruction, and the stored pixels are what is left. Rotate the photo instead — that bakes the turn into the pixels and clears the metadata in the same pass.
How do I know which orientation value my photo has?
Open it in the image metadata viewer, which reads the tag without modifying the file. A value of 1 or a missing tag means the stored pixels are the picture as you see it. Values 5 to 8 mean the width and height you see are swapped relative to what is stored.
Does rotating a photo lose quality?
A 90° or 180° turn rearranges whole pixels with no interpolation, so nothing is blurred. JPG and WebP are re-encoded at 92% quality on save, which moved the average pixel by 0.50 of a level out of 255 across six test photographs. A second pass added 0.02 more, so the two-pass fix costs very little beyond the first.
Does rotating a PNG lose quality?
No — PNG is lossless, and the pixels came back identical in seven test images. The file usually gets larger though: the median across those seven was 38% bigger, because the browser's PNG encoder does less optimisation work than the tools that normally write PNGs. One wide-gamut screenshot was the exception and came out 1.7% smaller.
Can I just rotate once instead of twice?
Only if the picture actually needs turning. One pass at the angle you need both fixes the picture and bakes it in. The two-pass 180° trick is for a photo that already looks right in your browser but comes out sideways elsewhere — there you want the pixels rewritten without changing what you see.
Are my photos uploaded to fix this?
No. The decoding, rotation and re-encoding all run in this page using the browser's own image APIs. The photo, its metadata and its GPS coordinates never leave your device.