Clioos › Guides › Rotate PDF Pages

How to Rotate PDF Pages

By Clioos Team

A scanned page that came out sideways, or a landscape page in a portrait document — rotating fixes it without touching the content. The free way is one command with qpdf, or a short pypdf script. Here is the exact flow, tested.

At a glance

Steps

  1. Install qpdf (free, open source): on Linux sudo apt install qpdf; on macOS brew install qpdf. The test used qpdf 11.9.0.
  2. Rotate one page: qpdf --rotate=+90:1 input.pdf output.pdf — only page 1 turns; the rest stay as they were.
  3. Rotate all pages: qpdf --rotate=+90:1-3 input.pdf output.pdf — on the test file this set all 3 pages to 90 degrees. Use :1-z when you do not know the page count.
  4. Check the result: open the output and confirm the pages show upright. On the test file the output was 2,372 bytes, barely different from the 2,670-byte original.
  5. No qpdf? pypdf does the same in a script (see the section below): page.rotate(90) on each page you want turned.

Worked example (tested 6 November 2026)

I tested this with a 3-page A4 PDF (2,670 bytes). With pypdf, page.rotate(90) on page 1 set its /Rotate flag to 90 and saved a 2,240-byte file. With qpdf, --rotate=+90:1 turned page 1 only (2,370 bytes, page 2 still at 0), and --rotate=+90:1-3 turned all three (2,372 bytes, all pages at 90). One gotcha: page ranges are 1-based — --rotate=+90:0 fails, because there is no page 0.

from pypdf import PdfReader, PdfWriter

reader = PdfReader('input.pdf')
writer = PdfWriter()
for page in reader.pages:
    writer.add_page(page)
writer.pages[0].rotate(90)  # first page only
with open('rotated.pdf', 'wb') as f:
    writer.write(f)

What it can't do (tested)

Free alternatives, honestly compared

PDF Probe does not rotate pages. It converts PDF tables and bank statements to Excel — if that is the job, see How to Convert PDF to Excel.

Frequently asked questions

Can I rotate just one page?

Yes. With qpdf, --rotate=+90:1 turns page 1 only. With pypdf, call rotate(90) on the one page you want.

What angles can I use?

90, 180, or 270 degrees. A PDF page cannot be rotated by any other angle — 45 degrees is not supported.

Will rotating change the file size?

Barely. The test file went from 2,670 bytes to 2,372 bytes after rotating all 3 pages — rotation only sets a flag, it does not re-encode the content.

Why does my rotated page still look sideways in one viewer?

Some older viewers ignore the /Rotate flag. Open the file in a modern browser or PDF reader to check — most handle it correctly.


Related guides: How to Split a PDF · How to Merge a PDF · How to Edit a PDF · How to Unlock a PDF · All guides · Tool: PDF Probe