PDF Rotation, Explained
After reading this you will understand how a PDF stores page orientation, why rotation is lossless, and how to fix sideways scans without re-rendering a single pixel.
What page rotation actually is
A PDF page has content: text, vector lines, and embedded images, all drawn on a fixed coordinate grid. Separate from that content, each page carries a small integer called /Rotate. It tells a viewer how many degrees to turn the page clockwise before showing it. The value is one of 0, 90, 180, or 270.
Here is the hook. Suppose you scan a landscape receipt and it comes out lying on its side. The pixels are correct, but the page is rotated 90 degrees from what you want. You do not need to re-scan or re-encode the image. You change one number in the page dictionary from 0 to 270 and the viewer turns the page for you. The image bytes are untouched. The file grows by a few characters at most.
This is why the tool describes rotation as lossless and instantly reversible. Nothing is redrawn. A 40 MB scanned document rotated four times over is still 40 MB, byte for byte, minus the tiny changes to four integers.
How the /Rotate value is stored
Inside a PDF, a page is a dictionary of key-value pairs. A minimal page object looks roughly like this in the file's text form:
<< /Type /Page /MediaBox [0 0 612 792] /Rotate 90 /Contents 5 0 R >>
The /MediaBox gives the page size in points, where 1 point is 1/72 inch. So 612 x 792 is a US Letter page (8.5 by 11 inches). The /Rotate 90 entry says: display this page turned 90 degrees clockwise.
The rotation is applied at display time only. The /MediaBox does not change, and the text drawing commands do not change. A viewer reads /Rotate, applies the turn, and shows the result. If /Rotate is absent, the value defaults to 0.
The value must be a multiple of 90. The PDF specification treats other numbers as an error, and most viewers round to the nearest multiple of 90 or ignore the entry entirely. This tool only offers 90, 180, and 270, so you never produce an invalid file.
The arithmetic of stacking rotations
Rotation is measured clockwise and wraps around a full circle. When you rotate a page that already has a rotation, the two values add, then reduce modulo 360.
Here R_{\text{old}} is the page's current /Rotate value, R_{\text{applied}} is the turn you ask for, and R_{\text{new}} is what gets written back. The \bmod 360 keeps the result in the range 0 to 359.
A worked check: a page at 270 that you rotate by 180 becomes (270 + 180) \bmod 360 = 450 \bmod 360 = 90. So the stored value ends at 90, not 450. That is why four 90 degree turns return you exactly to the start: (4 \times 90) \bmod 360 = 0.
This also tells you that rotation is reversible without loss. To undo a 90 turn, apply 270, because (90 + 270) \bmod 360 = 0. Nothing about the page content records that a rotation ever happened.
A worked example matching the demo
Rotating a whole document by 90 degrees
The demo button rotates every page by 90 degrees clockwise using the field defaults. Suppose you load a 3 page PDF where each page starts at /Rotate 0. Watch the stored value on each page.
- Page 1 starts at
0. Applying90: (0 + 90) \bmod 360 = 90. - Page 2 starts at
0. Same result:90. - Page 3 starts at
0. Same result:90.
All three pages now carry /Rotate 90. On screen, a portrait page (612 wide, 792 tall) now displays as landscape (it appears 792 wide, 612 tall), but the /MediaBox is still [0 0 612 792]. The bytes of the content stream are identical to before.
If you clicked the demo again, each page would go from 90 to (90 + 90) \bmod 360 = 180, which looks upside down. Two more clicks bring you back to 0. That loop is the clearest proof that the operation loses nothing.
Try the rotation arithmetic yourself
When to rotate, and when to reach for another tool
Rotation is the right fix when the page content is correct but the orientation is wrong. Common cases: a scanner fed a page sideways, a photo taken in the wrong device orientation, or a landscape spreadsheet exported as portrait.
Rotation is the wrong fix in three situations. First, if you want to keep some pages and drop others, rotation does not remove anything; use the PDF Splitter or the PDF Page Extractor. Second, if the file is large because of high-resolution images, rotating does not shrink it; the PDF Compressor re-encodes the images. Third, if you need the pixels themselves turned (for a system that ignores /Rotate), export with PDF to Images, rotate the images, then rebuild with Images to PDF.
If different pages need different turns, rotate the whole document to fix the majority first, then apply a correcting turn to the few odd pages. Because turns stack modulo 360, you never have to compute the exact target by hand.
Common mistakes and how to avoid them
The most frequent surprise is a viewer that ignores /Rotate. A correctly rotated PDF can still appear sideways in a program that reads content but not the page dictionary. This is a viewer bug, not a broken file. Most current readers honor the value.
The second mistake is confusing clockwise and counter-clockwise. This tool rotates clockwise. To turn a page counter-clockwise by 90 degrees, apply 270, since (0 + 270) \bmod 360 = 270 looks the same as a 90 degree left turn.
The third is rotating twice by accident. If a page already reads 90 from an earlier fix, applying another 90 lands you at 180 (upside down), not back at 0. Use the page thumbnails to confirm the current orientation before you apply a turn.
Rotation does not touch text or embedded metadata, so a rotated scan still carries any author name, software tag, or GPS-tagged image inside it. If privacy matters, run the file through the PDF Metadata Viewer & Stripper as well.
Where rotation fits with the other PDF tools
Rotation pairs naturally with assembly. If you scan a stack of pages in mixed orientations and then join them, fix orientation first, then combine with the PDF Merger. Because rotation changes only four small integers per page, doing it before or after a merge gives the same visual result. Doing it first is easier to verify page by page.
| Goal on screen | Direction | Value to apply | Resulting /Rotate |
|---|---|---|---|
| Quarter turn right | Clockwise | 90 | 90 |
| Upside down | Either | 180 | 180 |
| Quarter turn left | Counter-clockwise | 270 | 270 |
| No change | Full turn | 360 (not offered) | 0 |
Frequently asked questions
Does rotating a PDF reduce its quality?
No. Rotation changes the /Rotate integer in each page dictionary. No image is re-encoded and no text is redrawn, so quality and file size stay essentially the same.
Why does my page still look sideways after rotating?
Some viewers do not honor the /Rotate value. Open the file in a current reader to confirm the orientation is correct. If a specific program keeps ignoring it, render the pages to images and rebuild the PDF so the pixels themselves are turned.
Can I rotate only a few pages instead of all of them?
Yes. The tool lets you select individual pages and shows thumbnails so you can see each page's current orientation before applying a turn. Only the pages you choose get a new /Rotate value.
How do I undo a rotation?
Apply the complementary turn. A page rotated by 90 returns to normal after applying 270, because 90 plus 270 is 360, which reduces to 0. A page rotated by 180 returns after another 180.
Do my files get uploaded anywhere?
No. The rotation runs entirely in your browser. Your files never leave your device, which also means large PDFs are processed at local speed with no upload wait.