Module 1: Image formats and compressionLesson 8 of 255 min read
Why photos appear sideways or upside down, and how to fix them for good
The photo looks fine on your phone. You send it, upload it to a form or open it on a computer, and suddenly it is lying on its side or standing on its head. Nothing is wrong with the picture itself. The cause is a small instruction stored inside the file, and whether the app you're using reads it. This guide explains that instruction, why some apps get it wrong, and the two ways to fix a sideways photo so it stays fixed.
The camera doesn't always turn the picture
When you hold a phone sideways or upside down, the camera sensor is turned too. Rather than rotating the picture data, a camera can save the image as the sensor captured it and add a note saying which way up it should be shown. The Exif standard defines an Orientation tag for this: it records the orientation of the camera relative to the scene when the photo was taken.
The jpegclub.org page on Exif orientation explains that a camera can set this tag from its orientation sensor without transforming the image data itself. The photo is stored one way and displayed another.
The eight orientation values
The tag holds a number from 1 to 8. Microsoft's developer reference for photo orientation describes each one as an instruction for how to rotate the photo to display it correctly:
- 1: no rotation needed; the photo is already upright.
- 3: rotate 180 degrees.
- 6: rotate a quarter turn clockwise (Microsoft writes it as 270 degrees counter-clockwise).
- 8: rotate a quarter turn counter-clockwise.
- 2 and 4: flip horizontally or vertically, a mirror image.
- 5 and 7: a quarter turn combined with a horizontal flip.
Most photos use four values
Turning a camera by hand only rotates the picture, which matches 1, 3, 6 or 8. The values 2, 4, 5 and 7 also involve a mirror image, which turning a camera doesn't produce.
Why some apps show it sideways
The tag only works if the app reads it. An app that ignores it shows the pixels exactly as they were stored, which for a photo taken with the phone held sideways means a picture lying on its side.
In web pages, following the tag is the default. MDN, the web documentation run by Mozilla, lists from-image as the initial value of the CSS image-orientation property: the Exif information in the image is used to rotate it appropriately. Not every program, upload system or image library does the same, and you can't tell from the outside which ones read the tag.
The problem can also be created by accident. A tool that removes all metadata, including the orientation tag, but leaves the stored pixels as they were, turns a correct photo into a sideways one.
The double-rotation trap
The opposite mistake also happens. If a program turns the pixels upright but leaves the old tag in place, an app that reads the tag turns the picture a second time, and it ends up sideways again or upside down.
The jpegclub.org page notes that the jpegtran tool deliberately does not change the tag during its lossless rotations, and that a separate script is used to rotate the image and then set the tag so it stays consistent. The goal of that script is a file whose Orientation becomes 1. Any correct fix ends the same way: pixels and tag must agree.
Rotating by eye can make it worse
If a photo looks sideways in one app, rotating it there may fix that app and break the others. Check the result in a second app, such as a web browser, before you send it.
Two ways to fix it
Keep the tag. The pixels stay as stored and the tag keeps doing its job. Nothing is re-saved, so there is no quality cost, but you still depend on every app that opens the file reading the tag.
Save it upright. The picture is turned so the pixels themselves are the right way up, and the tag no longer matters. This works in every app, including ones that ignore Exif. For a JPG it means saving the picture again, which costs a little quality; the guide on image compression explains why.
For a photo going to an upload form, an older system or a printer, saving it upright is the safer choice.
What our tools do
Crop image, the converters, the compressor and the resizer all save a new picture. They apply the photo's orientation tag to the pixels, so the new file is saved upright and no longer needs the tag. In Crop image you can also use rotate left, rotate right and mirror if the photo was taken the wrong way up in the first place, and apply the same crop to many photos.
Remove EXIF data works the other way. It keeps the orientation tag on purpose while removing other details, so a photo that displays correctly before cleaning still displays correctly after. Everything runs in your browser and nothing is uploaded.
Open a sideways photo, check it stands the right way, and save an upright copy that looks the same in every app.
Crop imageQuick check
Three questions. Pick an answer to see why.
A photo is upright on your phone but sideways after uploading to an old web form. What's the likely cause?
Show the answer
Answer: The form ignores the Exif orientation tag and shows the pixels as stored The phone reads the tag; the form doesn't, so the stored pixels appear sideways.
Which fix makes a photo display correctly even in apps that ignore Exif?
Show the answer
Answer: Saving it with the pixels turned upright Once the pixels are upright, there's nothing left for an app to get wrong.
A program rotated the pixels upright but kept the original tag of 6. What happens in an app that reads the tag?
Show the answer
Answer: It rotates the picture again, so it ends up sideways The tag still says to turn it, and the app obeys, turning an already upright picture.
Rules change
File formats and official photo rules change. Each guide shows the date it was last checked; for forms and official photos, the authority's own page has the final word.
Sources
- Microsoft Learn – PhotoOrientation Enum
- MDN – image-orientation
- jpegclub.org – Exif Orientation Tag (Feb 17 2002)
Last checked October 27, 2026