Rotating and Flipping Images Without Losing Quality

After reading this you will understand what a 90° rotation does to pixels, why it stays perfectly sharp, how EXIF orientation fools your eyes, and how to pick the right transform for a sideways photo.

What this tool does and one common case

A rotate or flip in 90° steps moves every pixel to a new position on a grid. It does not invent, blur or discard color values. A photo that is 4000 pixels wide and 3000 tall becomes 3000 wide and 4000 tall after a quarter turn, and each of the 12,000,000 pixels lands on exactly one destination cell.

The usual hook: you receive a photo that looks sideways in one app and upright in another. The pixels never changed. What changed is whether the viewer respected the EXIF orientation flag. This tool bakes the correct orientation into the pixel data so the image reads the same everywhere.

When to use it, and when not to

Use a 90°, 180° or 270° rotation when a photo came off a phone or scanner turned the wrong way. Use a horizontal flip to mirror an image left to right, which is handy for correcting a selfie or matching the direction a subject faces. Use a vertical flip to mirror top to bottom, which is rarer but useful for reflections and scanned negatives.

Do not reach for this tool when you need an arbitrary angle such as 7^\circ to straighten a crooked horizon. Any angle that is not a multiple of 90° forces the software to resample: it must average neighboring pixels to fill the new grid, and that averaging softens edges. This tool deliberately offers only the four lossless steps.

If your only problem is that a phone photo displays sideways, try a single 90° step first and check the preview. Most camera-roll rotations are exactly one quarter turn in one direction.

The transform, stated as coordinates

Think of a pixel at column x and row y in an image that is W pixels wide and H pixels tall. Columns run 0 \le x \le W-1 and rows run 0 \le y \le H-1. A 90° clockwise rotation sends that pixel to a new location:

(x', y') = (H - 1 - y,\ x)

Here x' is the new column and y' is the new row. The output image is H wide and W tall, so width and height swap. The term H - 1 - y flips the vertical axis into a horizontal one, which is why a clockwise turn moves the top row to the right edge.

The other transforms follow the same pattern. A 180° rotation is (x', y') = (W - 1 - x,\ H - 1 - y) and keeps the dimensions. A horizontal flip is (x', y') = (W - 1 - x,\ y). A vertical flip is (x', y') = (x,\ H - 1 - y). Every one of these is a bijection: each source pixel maps to one destination, and each destination receives one source. That is the reason nothing is resampled.

On a 4-wide by 3-tall grid, the top-left pixel (0,0) moves to column 2, row 0 under a 90° clockwise rotation, because the new column is H - 1 - y = 3 - 1 - 0 = 2 and the new row is x = 0. Under a horizontal flip that same pixel moves to column 3, row 0.

A worked example with the demo image

Load the tool with its default sample and apply a single 90° clockwise rotation. Suppose the sample is 1200 pixels wide and 800 tall, giving 1200 \times 800 = 960{,}000 pixels.

Following the corner pixels

  1. The output size swaps to 800 wide by 1200 tall. Pixel count is still 800 \times 1200 = 960{,}000.
  2. The top-left source pixel is (x, y) = (0, 0). Apply (H - 1 - y,\ x) with H = 800: it lands at (799, 0), the top-right corner of the result.
  3. The bottom-left source pixel (0, 799) lands at (800 - 1 - 799,\ 0) = (0, 0), the new top-left.
  4. The top-right source pixel (1199, 0) lands at (799, 1199), the new bottom-right.

The left edge of the original becomes the top edge of the result. That matches the physical act of turning a printed photo a quarter turn clockwise. Because every mapping is integer to integer, the exported file holds the same set of color values, only rearranged.

File size after the transform

The pixels are identical in value, but the compressed file size can shift. JPEG and WebP encode along rows in 8x8 or 16x16 blocks, so rotating changes which neighbors sit next to each other and how well the encoder predicts them. A landscape sky that compressed smoothly across long rows may compress slightly worse once those rows become columns.

The table below shows a realistic pattern for one 960,000 pixel photo re-encoded at JPEG quality 85.

Approximate JPEG size for the same image under each transform, quality 85
TransformWidthHeightSize (KB)Change vs original
Original12008002120%
90° clockwise8001200219+3.3%
180°1200800213+0.5%
Horizontal flip1200800211-0.5%

The 180° and flip cases stay near 212 KB because they keep row structure intact. The quarter turn drifts a little more, here 7 KB, because rows and columns swap roles. Export as PNG or WebP lossless if you want the pixels preserved bit for bit.

The transform itself is lossless. Any size or quality change comes from re-encoding a JPEG, which is a lossy format by design. To avoid a second round of JPEG loss, export to PNG or lossless WebP.

EXIF orientation, the hidden rotation

Most phone cameras hold the sensor in one physical orientation and record how you held the device as an EXIF Orientation tag with values from 1 to 8. Value 1 means upright. Value 6 means the viewer should rotate 90° clockwise. Value 3 means 180°.

A well-behaved viewer reads that tag and rotates on display. A viewer that ignores it shows the raw sensor pixels, which look sideways. That single flag is why the same file looks correct in your phone gallery and wrong in a plain web page.

Rotating here writes the correct orientation into the pixels and resets the flag to upright. Do not then rotate a second time in another editor that still trusts an old EXIF value, or you will double-apply the turn and end up sideways again.

Common mistakes

Confusing a flip with a rotation is the frequent one. A horizontal flip mirrors the image, so any text in the photo reads backward. A 180° rotation keeps text readable but upside down. They are different transforms even though both leave the dimensions unchanged.

The second mistake is chaining lossy exports. If you rotate a JPEG, save, then flip and save again, you pass the pixels through the JPEG encoder twice and lose a little detail each pass. Do all your 90° steps in one session and export once.

The third: assuming clockwise and counter-clockwise land in the same place. They do not. A 90° clockwise turn followed by another 90° clockwise turn equals 180°, while clockwise then counter-clockwise returns you to the start.

Related tools on this site

Once the orientation is correct, you may want to keep editing. To fix exposure, use the Brightness & Contrast Editor. To hide a face or a license plate, use the Blur / Pixelate Redactor. To size a corrected photo for a platform, use the Social Media Image Cropper. To stamp ownership, use the Watermark Tool. For grainy shots, the Image Noise Remover helps, and to drop a plain backdrop try the Background Remover. For a quick caption, the Meme Generator adds top and bottom text.

Frequently asked questions

Does rotating a photo reduce its quality?

The rotation itself does not. Each pixel moves to a new grid cell with its color unchanged. Any quality loss comes only from re-saving a JPEG, which re-compresses the data. Export as PNG or lossless WebP to keep every pixel exact.

Why does my photo look right on my phone but sideways on the web?

Your phone stored an EXIF orientation flag and rotates the image on display. The web page ignored that flag and showed the raw sensor pixels. Baking the rotation into the pixels here makes it look correct in both.

What is the difference between a 180° rotation and a vertical flip?

A 180° rotation maps (x, y) to (W-1-x,\ H-1-y), turning the image upside down while keeping text readable in mirror. A vertical flip maps to (x,\ H-1-y) only, so the left and right stay put and the image reflects top to bottom.

Can I rotate by an angle like 45 degrees?

Not with this tool. Any angle that is not a multiple of 90° requires resampling and blurs edges, so only the four lossless steps are offered here.

Will the file get bigger after rotating?

For a JPEG it may change by a few percent because the encoder sees different pixel neighbors. In the worked table a quarter turn added about 3.3%, while a flip changed size by under 1%. Lossless formats keep the size essentially the same.