Why Photos Appear Sideways: EXIF Orientation, Rotating and Mirroring Explained
You take a photo in portrait mode, it looks fine on your phone, and then it appears sideways when you upload it to a website or open it on an old computer. The image isn’t broken. It’s stored sideways on purpose, with a small note telling software how to turn it upright. Not every program reads that note.
How cameras record rotation
A phone’s camera sensor has a fixed orientation, usually landscape. When you hold the phone upright, the sensor still captures the image sideways. Rotating millions of pixels on every shot would take time and battery, so most cameras save the pixels as captured and add an orientation tag to the photo’s EXIF metadata. The tag says, in effect, “rotate this 90° clockwise before showing it”.
The EXIF orientation tag has eight possible values:
| Value | Meaning |
|---|---|
| 1 | Normal, no change needed |
| 2 | Mirrored horizontally |
| 3 | Rotated 180° |
| 4 | Mirrored vertically |
| 5 | Mirrored horizontally, then rotated 270° clockwise |
| 6 | Rotated 90° clockwise |
| 7 | Mirrored horizontally, then rotated 90° clockwise |
| 8 | Rotated 270° clockwise (90° counter-clockwise) |
Values 1, 3, 6 and 8 cover almost all real photos. The mirrored values mostly come from front-facing cameras and some scanners.
Why it looks right in one place and wrong in another
Software that reads the tag displays the photo upright. Software that ignores it shows the raw pixels, sideways. Over the years, support has improved a lot:
- Modern browsers respect EXIF orientation for images by default (the CSS
image-orientation: from-imagebehaviour), which became consistent across major browsers around 2020. - Phone galleries, macOS and Windows photo viewers handle it.
- Older software, some content management systems, image processing scripts and many email and chat tools strip the metadata or ignore it.
The worst case is when a tool removes the metadata without rotating the pixels. The orientation note is gone, the pixels are still sideways, and now every program shows it sideways. This is a common side effect of privacy tools and compression scripts. Our EXIF remover detects a rotation flag and re-encodes such photos upright for exactly this reason.
The permanent fix: rotate the pixels
The reliable solution is to rotate the actual pixels and set the orientation to “normal”. Then the image looks the same everywhere, with or without metadata. The rotate and flip tool above draws the image onto a canvas in its displayed orientation and exports it, so the result is always stored upright.
Lossless versus lossy rotation
| File type | Rotating 90° steps | Notes |
|---|---|---|
| PNG, lossless WebP | Lossless | Pixels are moved, not recompressed lossily |
| JPEG (re-encoded) | Slight quality loss | The image is decoded, rotated and compressed again |
| JPEG (lossless transform with jpegtran or similar) | Lossless | Rotates the compressed 8×8 blocks directly; edges may need trimming if dimensions aren’t multiples of 8 or 16 |
| Any format, rotating by non-90° angles | Always resampled | Pixels must be interpolated, which softens the image slightly |
For everyday use, re-encoding a JPEG at high quality (90–95) after rotation is practically invisible. If you rotate the same JPEG back and forth many times, though, quality degrades with each save, so rotate once from the original. For a perfectly lossless result, export PNG.
Flipping: when and why
Flipping (mirroring) is different from rotating: it reverses the image left to right or top to bottom. It has real design uses:
- Directing attention. People in photos draw the viewer’s eye in the direction they face. Flipping a portrait so the person looks into the page, toward the headline, keeps attention on your content.
- Fixing selfies. Front cameras often preview a mirrored image; some save it mirrored too. Flipping restores the real-world orientation, which matters if the photo contains text or a logo.
- Layout balance. A product shot facing left may fit a right-aligned layout better when mirrored.
When not to flip:
- Anything with text, logos, numbers or signage, which become obviously backwards.
- Recognisable people or places in documentary or news contexts, where mirroring misrepresents reality.
- Faces in portraits that people know well. Most faces aren’t symmetrical, and a mirrored version of someone you know looks subtly odd. (Interestingly, people often prefer the mirrored version of their own face, because it’s what they see in the mirror.)
Rotating in CSS versus rotating the file
On a website, transform: rotate(90deg) turns an element visually, and scale(-1, 1) mirrors it. That’s fine for interface effects, icons and animations. But it doesn’t fix the underlying file, and rotating a landscape image with CSS doesn’t change the space it occupies in the layout, which can cause overlaps. For photos, rotate the file. Our CSS transforms guide covers the CSS side.
Straightening small tilts
Rotation in 90° steps fixes sideways photos. A slightly tilted horizon needs a small rotation, like 1.5°, followed by a crop to remove the angled corners. Small rotations always resample the image slightly, so do them once, on the original, and crop afterwards with an image cropper.
Fixing a sideways photo for good
- If a photo looks sideways somewhere, it probably relies on an EXIF orientation tag.
- Rotate the pixels permanently and save; don’t just strip metadata.
- Export PNG for a lossless result, or high-quality JPEG for photos you will share.
- Flip only images without text and where mirroring doesn’t misrepresent reality.
- Keep the original file.