Staaarter

JPG Rotator

Uploads a JPG and rotates it clockwise by any number of degrees around its center, expanding the output canvas to fit the full rotated bounding box and filling newly exposed corners with a white matte since JPG has no transparency, then lets you download the rotated JPEG. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-29
By Staaarter Team
editorrotateimagecanvasjpg

Overview

Introduction

This tool rotates a JPG by any angle you choose, entirely in your browser, expanding the canvas so no content is clipped.

Because JPG can't have transparent pixels, the freshly exposed corners left by an angled rotation are filled with a clean white matte instead.

What Is JPG Rotator?

A client-side JPG rotation tool that reads an uploaded image's pixel data and applies a standard 2D rotation matrix around the image's center, computing a larger output canvas sized to fit the rotated bounding box.

It supports any angle, not just the 90-degree multiples a simpler tool might offer.

How JPG Rotator Works

For every pixel of the (larger) output canvas, the tool works backward: it computes where that output pixel would have come from in the original, unrotated image using the inverse rotation, and copies that source pixel's color if it falls within bounds.

Pixels that map outside the source image's bounds (the newly exposed corners) are left blank in the pixel buffer and get flattened onto a white matte by the shared preview panel before you see or download the result.

When To Use JPG Rotator

Use it to straighten a slightly tilted photo, create a deliberately angled graphic for a design layout, or rotate an image to a specific orientation like 90 degrees for a portrait/landscape swap.

For the common 90-degree-step case specifically, the orientation changer tool offers a pixel-perfect alternative with no matte fill needed.

Features

Advantages

  • Supports any rotation angle, not just fixed 90-degree steps.
  • Expands the canvas automatically so no part of the original image is cropped away.
  • Runs entirely client-side; nothing is uploaded to a server.

Limitations

  • Nearest-neighbor sampling can introduce slight jagged edges at non-90-degree angles compared to a smoothing interpolation.
  • Non-90-degree rotations always require a matte fill for the exposed corners, since JPG can't represent true transparency there.

Examples

Straighten a slightly tilted photo

Input

A 1200x800 JPG, angle 3°

Output

A slightly larger JPG with the photo rotated 3° clockwise and white-filled corners

A small correction angle still requires canvas expansion and corner fill.

Rotate a graphic 45 degrees

Input

A 500x500 JPG, angle 45°

Output

A ~707x707 JPG with the original centered and rotated, corners filled white

At 45°, the bounding box grows to roughly the diagonal length of the original square.

Best Practices & Notes

Best Practices

  • For exact 90/180/270-degree rotations with no matte fill needed at all, use the orientation changer tool instead.
  • If you plan to crop afterward anyway, a slight white matte border from an angled rotation is easy to trim away.

Developer Notes

rotateJpg mirrors the equivalent PNG-category rotator's inverse-sampling rotation matrix math exactly, just against the jpg PixelBuffer/JpgToolResult types; it deliberately leaves exposed pixels at alpha 0 rather than pre-filling white, since JpgPreviewPanel already flattens onto a white matte at render/download time.

JPG Rotator Use Cases

  • Straightening a tilted scan or photo by a small angle
  • Creating an angled graphic element for a design
  • Rotating an image to a specific non-90-degree orientation

Common Mistakes

  • Expecting a transparent border around an angled rotation: JPG output always fills exposed corners with a solid white matte instead.
  • Using this tool for a simple 90-degree portrait/landscape fix when the orientation changer tool would give a cleaner, pixel-perfect result.

Tips

  • Combine with the cropper afterward if you want to trim away the white-matte corners left by an angled rotation.
  • Use the preset 90/180/270 buttons for the common cases before reaching for the custom angle field.

References

Frequently Asked Questions