Rotate PDF

Published Updated

Turn all pages, or only the ones you list, by 90 or 180 degrees without redrawing them, so nothing loses quality.

A lossless turn in steps of 90 degrees

Every PDF page has a Rotate entry that tells viewers how far to turn it when displaying or printing. The PDF specification requires the value to be a multiple of 90. This tool adds your chosen angle to that entry on the pages you pick, folds the result into 0, 90, 180 or 270, and saves the file. The page content itself is untouched.

That is why the result is lossless and fast even for large scans.

How the angle adds up

The new rotation is the old one plus your choice, kept between 0 and 270. Examples for a single page:

Page nowYou choosePage after
0 (upright)90 clockwise90
9090 clockwise180, upside down
9090 counter-clockwise0, upright again
0180180
27090 clockwise0, upright (written as 0, not 360)

The number written into each page, and what pdf.js shows

We ran the site's own Rotate PDF component in Google Chrome 156, Chromium 153 (Playwright build, not Google Chrome), Firefox 155 and Playwright's WebKit build (not the Safari app) on a generated eight-page file. Each page carries a red square in the top-left corner of the page as stored, so the corner where the square ends up shows which way the page is displayed. Every output was read back twice: the stored /Rotate value with pdf-lib 1.17.1, and the displayed rotation with pdf.js 5.4.624 (pdfjs-dist, the renderer this site uses for its page previews). All four engines wrote the same values.

Page as stored90° Clockwise90° Counter-Clockwise180°
Rotate 0 (A4)90, shown at 90270, shown at 270180, shown at 180
Rotate 90180, shown at 1800, shown upright270, shown at 270
Rotate 180270, shown at 27090, shown at 900, shown upright
Rotate 2700, shown upright180, shown at 18090, shown at 90
No Rotate of its own, 90 inherited from the page tree180 written on the page, shown at 1800, shown upright270, shown at 270
Rotate -900, shown upright180, shown at 18090, shown at 90
Rotate 450180, shown at 1800, shown upright270, shown at 270
Rotate 0 (US Letter landscape)90, shown at 90270, shown at 270180, shown at 180

The tool adds your angle to whatever number is stored and writes the sum folded into 0, 90, 180 or 270, so a page stored as -90 or 450 comes out with one of those four values, and in every row the red square sat in the corner that rotation predicts. An inherited rotation is read correctly: the page with no Rotate of its own got 180 written on it. A second generated file held pages stored as 360, 540, 720, -180, -270 and -360, values that are multiples of 90 but outside that range; one clockwise turn wrote 90, 270, 90, 270, 180 and 90, and pdf.js showed each page at that angle.

The same turn applied four times in a row to a one-page file gave stored values of 90, 180, 270 and 0 for clockwise, 270, 180, 90 and 0 for counter-clockwise, and 180, 0, 180 and 0 for 180°; pdf.js displayed each value as stored.

Page lists and files the tool turns away

Typed into the page box of the same eight-page file, in the same run in Chrome 156, Chromium 153, Firefox 155 and the WebKit build (identical in all four):

You type or addResult
2, 5-6Rotated 3 pages: 2, 5 and 6; the other pages kept their stored values
1,1Rotated 1 page: page 1, turned once
1 - 2, or 2, with a trailing commaAccepted: pages 1 and 2, or page 2
3-3Rotated 1 page: page 3
0 or 9Page numbers must be between 1 and 8.
5-3Invalid range "5-3": the start page must not be greater than the end page.
abc, or 1;2Couldn't understand "abc". Use page numbers or ranges like 2-5.
An empty page boxThe Rotate PDF button stays disabled
A PDF with an open password (AES-256)This PDF is password-protected, and Please unlock it first using our Unlock PDF tool, then try again.
A PDF that opens without a password but carries print and copy restrictions (AES-256)The same password-protected message
The first 60% of a valid PDF, or 4,000 random bytes named .pdfCouldn't read this PDF file, and Please make sure it's a valid, unencrypted PDF and try again.
A page whose stored Rotate is 45, with All pagesPage 1 has a stored rotation that is not a multiple of 90°, so it can't be turned. Choose "Specific pages / range" and leave it out. Nothing was saved.
A six-page file with stored values 45, 0, 135, 90, -45 and none (30 inherited from the page tree), with All pagesPages 1, 3, 5, 6 have stored rotations that are not multiples of 90°, so they can't be turned. Choose "Specific pages / range" and leave them out.
The same six-page file with 2, 4 listedRotated 2 pages: page 2 to 90 and page 4 to 180; the other four kept their stored values
The same file with only page 2 listedRotated 1 page; the page with 45 was left as it was

The PDF specification (ISO 32000-1:2008, the page object table) says of Rotate: "The value shall be a multiple of 90." A page stored at 45 breaks that rule, and there is no single right way to turn it by 90: pdf.js displayed the pages stored at 45, 135 and -45 and the one inheriting 30 all upright, as if they were 0. The tool does not guess. It checks the pages you chose before saving anything, names the ones it cannot turn, and leaves the file as it was; listing only the other pages works.

Bigger files: size before and after, and how long it took

One run per engine, timed in the page from adding the file until the Rotate PDF button appeared (open) and from pressing Rotate PDF until the download link appeared (rotate), all pages turned 90° clockwise. Engines in the order Chrome 156, Chromium 153, Firefox 155 and the WebKit build:

Test fileBeforeAfterOpen (ms)Rotate (ms)
Eight mixed pages, written by pdf-lib2,829 bytes2,824 to 2,825 bytes43 / 42 / 48 / 4311 / 12 / 13 / 11
Two pages with bookmarks, a link and a form field, written by pikepdf without object streams2,635 bytes1,987 bytes42 / 43 / 47 / 4311 / 11 / 13 / 11
2,000 text pages (pdf-lib)2,136,611 bytes2,136,538 to 2,136,541 bytes318 / 323 / 440 / 487923 / 925 / 1,122 / 1,416
40 scan-like pages, one JPEG each, written by Pillow56,183,134 bytes56,175,169 to 56,175,170 bytes91 / 76 / 91 / 85124 / 128 / 190 / 127

Page content is not touched. The first page image of the 56 MB file, 1,340,931 bytes of JPEG data, had the same SHA-256 before and after, and the content streams of the two-page file hashed the same before and after. The size changes come from the PDF library writing the whole file again: the file saved without compressed object streams shrank by about a quarter, and the large scan lost 7,964 to 7,965 bytes. In the two-page file the two bookmarks, the link, the form field value and the XMP metadata stream were all still there; the producer and creator fields were set to pdf-lib (the file had no creator before) and a modification date was added.

Only generated files were used: no real scans, no files from other PDF writers beyond pdf-lib, pikepdf and Pillow, and no file with a digital signature.

What the rotated copy keeps besides the new angle

Rotate PDF does not build a new document. pdf-lib loads your file, its setRotation call writes the new angle on each chosen page (the documentation says it rotates a page “by a multiple of 90 degrees”), and save serializes the whole document again. Measured in Google Chrome 157 with the site's own Rotate PDF component on a generated 4-page file with document-wide settings, all pages turned 90° clockwise; Firefox 155 and the WebKit build gave the same results:

In the source file (5,275 bytes)In the rotated copy (3,295 to 3,296 bytes)
Page labels i, ii, 1, 2Kept
Language en-US, a structure tree and MarkInfo (tags)Kept
Two layers, one off by default with a red square on itKept; pdf.js still hides the square (0 red pixels)
notes.txt attached to the document, and a 20-byte file attached to page 2Both kept
Open at page 3 with the bookmarks panel, one bookmark, show the title in the windowKept
Info: title, author, creator and creation dateKept as they were
Info: producer pikepdf generator, modification date 2 January 2026Producer set to pdf-lib, modification date set to the time of the save
An XMP metadata stream with that same producer and dateNot changed: it still names pikepdf generator and 2 January 2026
File identifier (/ID) in the trailerThe same two values
Version line %PDF-1.3%PDF-1.7

So the information dictionary and the XMP packet disagree after a rotation: one gives pdf-lib and the time of the save, the other the producer and date the file had before. Every page carried 90 afterwards.

Turning pages the right way up

  1. Step 1

    Add the PDF

    The tool reads the page count first. A password-protected file is turned away with a note to remove the password before rotating.

  2. Step 2

    Pick an angle and the pages

    90 degrees clockwise, 180 degrees or 90 degrees counter-clockwise, for all pages or a list such as 1-3, 7.

  3. Step 3

    Save the rotated copy

    Only the rotation setting of those pages changes. The file downloads with -rotated added to its name.

Picking pages

Choose all pages, or type a list. The page box follows the same rules as the site's other page tools:

  • Single pages and ranges, separated by commas: 1-3, 7, 10-12.
  • A page listed twice is turned once.
  • A range written backwards, such as 9-4, or a page number past the end is refused with a message.

Related fixes

To reorder pages rather than turn them, use Organize PDF. For page images rather than PDF pages, Rotate Image turns image files in 90 degree steps, and Straighten Image turns by any angle from -45 to 45 degrees in 0.1 degree steps.

Rotating PDF pages: answers

Does rotating reduce the quality of the PDF?

No. The tool changes each page's rotation number and nothing else, so text stays selectable and scans keep every pixel. No page is redrawn.

Can I rotate just one page?

Yes. Choose the page option and type its number, or a list with ranges such as 2, 5-8. Pages you do not list keep their current orientation.

I rotated a page and it is still wrong. Why?

The turn is added to the page's current rotation. A page that was already turned 90 degrees and gets another 90 clockwise ends at 180. Run the tool again on that page with the opposite turn.

Will the rotation stick when I open the file elsewhere?

Yes. It is saved in the page's Rotate entry, which PDF viewers and printers read, unlike the temporary rotate button in a viewer that only changes your view.

Can it straighten a slightly crooked scan?

No. PDF pages can only be turned in steps of 90 degrees. For a scan that is a few degrees off, straighten the image before making the PDF.

Does anything else in the file change?

Bookmarks, links and text stay. The PDF library saves the whole file again, which updates the producer field and the modified date, and invalidates an existing digital signature.

Which rotation value does the tool write into the page?

One of 0, 90, 180 or 270. It adds your turn to the stored number and folds the sum into that range: in our test a page stored at 270 came out at 0 after a clockwise turn, an upright page came out at 270 after a counter-clockwise one, and a page stored at 540 came out at 270 after a clockwise one, in Chrome 156, Chromium 153, Firefox 155 and the WebKit build. pdf.js showed each page at the stored angle.

Can I rotate a PDF that only blocks printing or copying?

Not directly. A file with only an owner password (it opens without a password but has restrictions) is still encrypted, and in our test it got the same password-protected message as a file with an open password. Unlock PDF with an empty password box saved a decrypted copy without those settings in our tests on that page, and that copy can then be rotated. Do that only for a file you own or have the right to change: the restrictions were set by its owner, and removing them can breach a licence or the law.

How long does a large PDF take?

A 2,000-page text file took about 1.2 to 1.9 seconds in total (opening plus rotating) across Chrome 156, Chromium 153, Firefox 155 and the WebKit build, and a 56 MB file of 40 scanned-style pages took under 0.3 seconds. One run each, on one Mac.

What does the message about a rotation that is not a multiple of 90 mean?

A page in the file stores a rotation such as 45, which the PDF specification does not allow, so the tool cannot turn it by a step of 90. The message named the page (Page 1 for a file stored at 45) and nothing was saved. Choosing Specific pages / range and listing the other pages worked, and the named page kept its stored value.

Why does a page turned twice by 180 degrees end up upright?

Because the turns add up and the stored value is kept between 0 and 270. A one-page file turned 180 degrees came out at 180, and turning that copy 180 degrees again wrote 0, the same as the page started with. Four clockwise turns in a row also came back to 0.

My PDF already says 540 or -90 for a page. What happens when I turn it?

Those values are multiples of 90, so the tool accepts them and writes the folded result. One clockwise turn took pages stored at -90 and 450 to 0 and 180, and pages stored at 360, 540, 720, -180, -270 and -360 to 90, 270, 90, 270, 180 and 90; pdf.js displayed each page at that angle.

Does the tool turn pages I did not list?

No. Listing 2, 5-6 in an eight-page file changed the stored value of pages 2, 5 and 6 only; the other five pages kept the value they had, including one stored at 450 that the tool would have folded had it been listed.

Does rotating keep page labels, layers and attachments?

Yes. The tool edits the loaded file rather than building a new one, so a generated file kept its page labels (i, ii, 1, 2), its language and tags, both layers with the hidden one still hidden, a document attachment and a page attachment, and its open-at-page-3 setting, in Chrome 157, Firefox 155 and the WebKit build.

Why does the rotated PDF show two different modification dates?

Saving writes a new modification date and pdf-lib as producer into the information dictionary, but the XMP metadata packet is not rewritten. In the test file the XMP still said pikepdf generator and 2 January 2026 after the rotation.

Does the rotated file keep its document ID?

Yes. Both values of the file identifier (/ID) in the trailer came out the same as in the source.

Related Tools