image · 6 min read

Why your photo is sideways on one device and not another

The same file. Correct in your gallery, correct in the email you sent, on its side the moment somebody opens it. Nothing changed, because nothing was ever rotated.

When you turn a phone sideways to take a photograph, the sensor does not turn with it. The pixels are recorded in the sensor's own orientation, which is whatever it physically is, and then the camera writes a small note in the file: this should be displayed rotated 90° clockwise.

The picture is not rotated. A note asking for it to be rotated is attached to it. Every piece of software that opens the file has to notice that note and act on it, and the ones that do not show you the pixels as recorded — on their side.

The tag

It lives in EXIF, the block of camera metadata attached to almost every photograph, and it is a single number called Orientation with eight defined values.

Only four are common: upright, rotated 90° one way, rotated 90° the other, and upside down. The other four describe mirrored versions, which arise from front-facing cameras and from scanners, and which almost nothing produces deliberately.

One number, eight possibilities, and a display that is either right or ninety degrees wrong depending on whether the software bothered to look.

Who reads it and who does not

Browsers read it — they have for years, in every engine. Phone galleries read it. Operating system previews read it. Modern image editors read it.

What does not read it, reliably, is anything older, anything minimal, and a surprising amount of server-side processing. Image libraries frequently decode the pixels and hand them on without consulting the tag, so an upload pipeline that resizes your photograph produces a correct-looking thumbnail that is sideways — or worse, a thumbnail that is upright while the original is not, because one stage read the tag and the next did not.

This is why the problem appears asymmetric and maddening. It is not the file changing. It is a chain of programs disagreeing about the same file.

The trap: stripping the metadata

This one catches people who are doing the right thing for the right reason.

You know that photographs carry GPS coordinates and camera serials, so you strip the EXIF before sending. Sensible. And the orientation tag is EXIF, so you have just removed the note — and the picture, which was never rotated, now displays on its side everywhere, including in the places that used to get it right.

The photo did not break when you stripped it. It was always sideways; the note was holding it up.

Any stripper worth using handles this: it applies the rotation to the pixels first, then removes the tag. That is what removing EXIF should mean, and it is worth checking rather than assuming, because a tool that simply deletes the block will silently turn every portrait photograph you own onto its side.

The fix that survives everything

Rotate the pixels.

Once the image is stored the way it should be displayed, the orientation tag is either absent or says "upright", and every program agrees — the ones that read the tag and the ones that never look. There is nothing left to disagree about.

Rotating is a real edit to the file rather than a change of note, which is precisely the point. Do it once, before uploading anything to a system whose behaviour you cannot predict, and the problem does not recur.

For a JPEG there is a lossless rotation — the 8×8 blocks are rearranged rather than re-encoded — but it only works when both dimensions are multiples of eight, which not every image is. A normal re-encode at high quality costs one generation and always works.

Why some uploads fix it and others break it

A site that resizes your upload has decoded the pixels, which means it had to decide about the tag. If it applied the rotation and saved the result upright, your photo is now permanently correct. If it ignored the tag and stripped the metadata while saving, your photo is now permanently sideways.

Both behaviours are common, neither is announced, and this is the whole explanation for why one platform "fixes" photos and another "breaks" them.

The short version

The tag is a note, not a rotation. Software that reads it shows the photo upright; software that does not shows what was recorded. Removing EXIF removes the note, so strip metadata only with something that applies the rotation first.

And if a photograph has to travel through systems you do not control, rotate the pixels before it leaves. It is the only state that means the same thing to everybody.

Questions

Why is my photo sideways after uploading it?

The camera never rotated the picture. It recorded the pixels in the sensor’s orientation and wrote an EXIF tag asking software to display it rotated. Anything that ignores the tag shows what was recorded — on its side.

Why did removing EXIF data rotate my photo?

The orientation tag is EXIF, so stripping the metadata removed the note that was holding the picture upright. The photo was always sideways. A stripper worth using applies the rotation to the pixels first and then removes the tag.

How do I permanently fix a rotated photo?

Rotate the pixels rather than the tag. Once the image is stored the way it should be displayed, every program agrees — the ones that read the tag and the ones that never look. It is the only state that means the same thing everywhere.

Why does one website fix my photo and another break it?

Both decoded the pixels and had to decide about the tag. One applied the rotation and saved the result upright, so your copy is now permanently correct; the other ignored the tag and stripped the metadata, so it is now permanently sideways. Neither announces which it does.

Does rotating a JPEG lose quality?

A lossless rotation exists — the 8×8 blocks are rearranged rather than re-encoded — but it only works when both dimensions are multiples of eight. A normal re-encode at high quality costs one generation of loss and always works.

Tools from this guide