Image Rotator

Turn a photo a quarter turn, or nudge a leaning horizon back by half a degree. The preview shows the exact canvas you will get, including the corners that grow or the ones you lose. Your file never leaves the tab.

Image rotation workspace

  • Nothing uploaded
  • Steps of 0.1°
  • PNG, JPG or WebP out

Drop an image here or tap to browse

JPG, PNG, WebP, GIF, BMP and SVG. One file at a time, decoded on your own machine.

A rotation is cheap. The corners are what cost you.

Turn a rectangle by anything other than a right angle and its four corners swing outside the old frame. A canvas holds no pixels beyond its own edges, so one of two things has to happen. Either the canvas grows and four triangular wedges of empty space open up around the photo, or the canvas stays the size it was and the corners get sliced off. Most rotation tools decide this for you in silence. Here it is a switch, and the resulting pixel dimensions sit under the preview before you download anything.

The fine angle runs in tenths of a degree because a lot of rotation work has nothing to do with quarter turns. It is a handheld shot with a sea horizon leaning by a degree and a half, or a receipt that fed into the scanner crooked, or a building whose vertical lines lean in a way the eye catches before the brain names it. On a 4000 pixel wide photo, a whole degree of overshoot is obvious. Half a degree is usually the difference between fixed and still wrong.

Right angles are free. Everything else resamples.

At 90, 180 and 270 degrees the source grid maps onto the destination grid one pixel to one pixel. Nothing is averaged. What comes back is the image you put in with its rows and columns exchanged, identical down to the byte if you save it as PNG. At 12.4 degrees no source pixel lands cleanly on a destination pixel, so the browser blends the four source pixels nearest the point each output pixel maps back to. The result is a slight softening of fine detail. On a photograph of trees or water you will not see it. On screenshot text, hairlines or a QR code you will.

The practical rule follows from that. Set the angle you want in one pass. Rotating three degrees, saving, deciding it was too much and rotating back by three degrees means the image has been resampled twice and re-encoded twice, and the second pass cannot recover what the first one blended away.

The geometry behind the growing canvas

Grow to fit computes the bounding box of the rotated rectangle, which is the same formula every image library uses:

outputWidth = width * |cos θ| + height * |sin θ|
outputHeight = width * |sin θ| + height * |cos θ|

Because both terms are positive for any angle off a right angle, the canvas grows in both directions at once. A small tilt costs more area than people expect. These are the numbers for a 1600 by 900 photo:

AngleCanvas after fitPixel area vs sourceWhat it looks like
1672 × 1036+20%Thin slivers at the corners, easy to crop away
15°1778 × 1283+58%Clear wedges, the crop starts eating real content
30°1836 × 1579+101%Twice the pixels, most of them empty
45°1768 × 1768+117%A perfect square, the photo sitting in it as a diamond
90°900 × 1600UnchangedA plain swap of width and height

That area growth is also file size growth, since the wedges still get encoded. A PNG of a 30 degree rotation with a flat fill compresses those wedges down to almost nothing. The same rotation saved as JPG does not, because the encoder spends bytes on the hard diagonal boundary between photo and fill.

Keep size crops instead of padding

The second canvas mode holds the output at the source dimensions and lets the corners fall outside. Nothing is padded and nothing is added. You lose the four corners of the original in exchange for dimensions that stay predictable, which is what you want when the image feeds a layout expecting exactly 1200 by 630, or when a batch of rotated frames has to keep matching sizes. Watch the preview before you commit, because content near an edge disappears first.

Straightening a leaning photo

There is no auto straighten button here, and adding one would mean guessing which line in your photo was meant to be level. A shoreline, a shelf and a road all read as strong horizontals to an edge detector, and only you know which one matters. The manual pass takes about fifteen seconds:

  1. Switch on the thirds grid. Its horizontal lines give you a straight reference to compare against the horizon or the top edge of a table. The grid sits over the preview only and never appears in the file you download.
  2. Click the preview and tap an arrow key. Each press moves half a degree, which is slow enough to see the line settle.
  3. Stop when the reference line runs parallel to a grid line rather than when the number looks tidy. Most crooked photos sit between 0.5 and 3 degrees off.
  4. Download with grow to fit on, then take the file to the image cropper and trim the wedges away. Straightening always costs you a small border, and there is no way around that.

The corner fill matters more than it sounds

The fill color paints only the wedges, so at a quarter turn it does nothing at all. Transparent is the default and works if you download PNG or WebP, both of which carry an alpha channel. JPG has no alpha, so choosing it switches the fill to white and tells you so, because a transparent pixel written into a JPEG comes out black on some decoders and white on others. When the rotated image is headed for a page you already know the background color of, set the fill to that color and the seam disappears.

The orientation flag your phone writes

Cameras and phones rarely rewrite pixels when you turn them sideways. They store the frame as the sensor read it and add an EXIF orientation tag saying which way is up. Photo apps read the tag. Plenty of other software does not, which is the reason a picture looks fine in your gallery and appears on its side after you email it or drop it into a form.

Rotating here settles the question. The image is drawn into a canvas at the orientation your browser shows, and the file that comes back holds pixels in that arrangement with no tag attached. The upside is an image that reads the same everywhere. The cost is that the rest of the metadata goes with it. Check the metadata viewer first if the shooting data, GPS position or color profile matters to you.

What runs where

Where this rotator stops

Questions that come up while rotating

Quality loss, canvas sizes, EXIF tags and what a browser based rotator will not do.

Does rotating an image reduce its quality?

At 90, 180 and 270 degrees the pixel grid maps one to one, so no detail is lost in the rotation itself. At any other angle the browser blends neighbouring pixels to fill the new grid, which softens fine detail slightly. Saving as PNG keeps whatever the rotation produced. Saving as JPG adds a second, separate loss on top from the encoder, which is why PNG is the default here.

Why did my image get bigger after a small rotation?

Grow to fit expands the canvas to the bounding box of the rotated rectangle, and that box is wider and taller than the original for any angle off a right angle. A 1600 by 900 photo turned 15 degrees needs 1778 by 1283 pixels to hold every corner, which is 58 percent more area. Switch to keep size if the dimensions have to stay fixed, and accept that the corners get cropped instead.

How do I straighten a crooked photo?

Switch on the thirds grid, click the preview, and tap the arrow keys to move half a degree at a time until the horizon or another line you know is level runs parallel to a grid line. Most handheld shots are between half a degree and three degrees off. Download, then crop the empty corners away with the image cropper. There is no automatic straighten because guessing which line was meant to be level goes wrong often enough to be worse than doing it by eye.

Is my image uploaded to a server?

No. The file is read by FileReader, decoded by the browser and drawn to a canvas inside the page. No network request carries the image anywhere, and you can confirm it by disconnecting after the page loads. The rotation, the preview and the download all keep working offline.

Why is the corner fill locked to a color when I pick JPG?

JPEG stores no alpha channel, so transparency has nowhere to go in the file. Rather than let the browser pick for you, which produces black corners in some decoders and white in others, the tool sets the fill to white and shows a note. Pick any color you like from there, ideally the background color of the page the image is going onto.

My photo appears sideways in one app and upright in another. Will this fix it?

Yes, and that is one of the better reasons to use it. Cameras often leave pixels in the sensor orientation and add an EXIF tag describing which way is up. Software that reads the tag shows the photo correctly and software that ignores it shows the photo on its side. Rotating here writes the pixels in their final arrangement with no tag involved, so every viewer agrees.

Can I rotate a JPG without any quality loss?

Not on this page. Lossless JPEG rotation works by rearranging the compressed 8 by 8 blocks without decoding them, which browsers give no access to. This tool decodes to pixels and re-encodes, so a quarter turn back to JPG costs a little quality. Choose PNG output to keep the rotated pixels exactly, or run jpegtran locally when the original has to stay untouched.

What happens to an animated GIF?

Only the first frame survives. Drawing an animated file to a canvas captures whatever frame is on screen at that instant, and the output is a single still image. Split the animation first with the GIF splitter if you need every frame turned.

Is there a size limit?

No hard limit, but memory sets a practical one. A decoded image occupies four bytes per pixel regardless of how small the file on disk is, and grow to fit allocates a second, larger canvas on top of that. Desktop browsers manage images in the tens of megapixels. Phones tend to fail somewhere lower, usually by producing a blank canvas rather than an error message.