Runs in your browser · pdf.js + pdf-lib

Rotate PDF Pages Online — left, right, 180°, or set them to portrait or landscape

Turn one page, a range, or the whole file. Fix a scan that came out sideways, flip a document that was fed face-down, or make every page match without touching the ones that are already correct.

How it works
Per-page rotation All / even / odd / range Set portrait or landscape Your PDF stays in your browser
Built & maintained by Bhavin J. Sheth Updated

The rotation console

Upload a PDF, pick a page group, and apply a rotation — every card updates live.

Drop your PDF here

or browse files

How rotation actually works

Rotation changes the page orientation without re-rendering its original content

Rotating a PDF changes its page orientation rather than intentionally re-rendering the original page content. The operation stays lightweight, although large PDFs may take longer to preview or export.

Why some pages come out sideways

A scanner tray, a phone camera held the wrong way, a page fed in face-down — none of these are content problems, they're orientation problems. Re-scanning fixes it too, but only if you still have the original paper.

Every PDF page carries a rotation value alongside its content. This tool changes that value using pdf-lib — 90°, 180°, or 270° per page — and pdf.js renders the live preview so you can confirm the result before it's written to the file. The rotation operation does not intentionally rasterize or re-compress the page content.

Three ways to target pages

By selection

All pages, even pages, odd pages, or a typed range like "2-5, 7, 9" — pick the group, then click a rotation once.

By individual page

Each page card includes its own rotate-left and rotate-right controls.

By target orientation

Click Portrait or Landscape and the tool compares each page's current dimensions, rotating only the ones that don't already match.

Stacked rotations

Clicking the same button repeatedly adds up — two Right 90° clicks equal one 180° flip, applied at export.

Original content preserved

Rotation changes the page orientation without intentionally re-compressing or rasterizing the original content.

A simple path to a corrected document

Select the pages, pick the rotation, export — individual fixes happen on the page card itself.

1

Upload your PDF

Drag it onto the upload area, or click Select PDF. Previews of every page render immediately — nothing is sent anywhere.

Rotate any single page right there in the grid, any time.
2

Apply a rotation

Use the console above the grid:

Choose all, even, odd, or a typed range of pages.
Click Left 90°, Right 90°, or Flip 180° to rotate that group.
Or click Portrait/Landscape to normalize orientation across the whole file.
3

Export

Click Apply Rotations & Export once the grid looks right. pdf-lib writes each page's rotation into a new file.

Runs in this tab — no upload, no wait on a queue.
4

Check, then download

Page through the exported file to confirm every orientation, rename it if you like, then download.

Full-file preview Page content preserved

One orientation action can fix a mixed scan

Four pages scanned in four different orientations, normalized in one pass.

As scanned Mixed orientation
Before rotation: pages facing in sideways and upside-down directions

A textbook scanned with pages fed in inconsistently.

Rotated
After — all portrait Normalized
After rotation: all pages corrected to portrait mode

One click on Portrait — pages 1, 2, and 4 rotated, page 3 left alone.

Documents that get scanned sideways, routinely

Situations where orientation is wrong often enough that fixing it in bulk beats fixing it by hand.

Common situations for rotating PDF pages, by user type
SituationWhat to rotateTypical user
Scanned textbooksPages fed upside-down or sideways in the scanner tray, made to read upright.Students & researchers
Legal exhibitsLandscape exhibit pages rotated to align with a portrait body document.Lawyers & paralegals
Financial reportsWide charts and tables turned landscape while the rest of the report stays portrait.Accountants & finance teams
Slide exportsEvery exported slide set to landscape before combining into one deck.Sales teams & consultants
Faxed documentsFaxes that arrive rotated 90°, corrected before filing.Office admins
Photo scansLandscape photos rotated so an entire album reads consistently in portrait.Families & photographers
Technical report scansReports fed sideways corrected before adding to a patient file.Researchers & laboratories
E-book preparationEvery chapter page made portrait before preparing a consistent e-book layout.Authors & self-publishers
What each button does

Four rotation controls, clearly explained

No guesswork — here's precisely what each rotation control changes.

Left 90° (counter-clockwise)

Turns the page a quarter-turn left. Use when the top edge needs to tilt leftward to read correctly — common for documents fed face-down.

Right 90° (clockwise)

Turns the page a quarter-turn right — the fix for most sideways scans, where the top edge needs to tilt rightward to become upright.

Flip 180°

A half-turn in one click. For pages scanned upside-down, this is faster than clicking a 90° button twice.

Portrait / Landscape

Compares each page's dimensions to the target and rotates only the mismatches — a page already in the right orientation is skipped, not re-rotated.

When a page won't turn the way you expect

Identify the problem, then use the matching fix.

Symptom
Why it happens
Fix

Page rotated the wrong way

A Left 90° click turned the page the opposite of what you expected.

Click the opposite button once, or click the same one three more times to reach the angle you want.

Portrait didn't change a page

The page is already in portrait, so the tool correctly leaves it alone.

Expected — the button only rotates pages that don't already match the target.

Rotation hit the wrong pages

All Pages was still selected when you meant to target a range.

Start Over, select Specific Pages, enter the range, then apply the rotation again.

Rotated page looks soft in preview

The browser preview renders at a fixed scale, which can look softer than the real output.

Download and open it in a PDF reader — rotation metadata preserves original fidelity.

Range field skipped some pages

A reversed range like "10-5", or a number past the document's length, is silently ignored.

Write ranges in ascending order (e.g., "5-10") and check the highest page number is valid.

A PDF reader still shows the old orientation

Some readers cache the previous render and don't refresh automatically.

Close and reopen the file, or open it in a different reader.

Preview updates slowly on a big PDF

Each rotation re-renders the affected canvases, which uses browser memory.

Normal for large files — use the bulk selectors instead of rotating pages one at a time.

A password-protected PDF won't rotate

Some password-protected or encrypted PDFs cannot be opened by browser PDF libraries.

Remove the password first with Unlock PDF, then upload the unlocked copy.

Page rotated the wrong way

Why: Rotation went the opposite direction.

Fix: Click the opposite button, or the same one 3 more times.

Portrait didn't change a page

Why: The page is already portrait.

Fix: Expected — mismatched pages only.

Rotation hit the wrong pages

Why: All Pages was still selected.

Fix: Start Over, select Specific Pages.

Rotated page looks soft in preview

Why: Preview renders at a fixed scale.

Fix: Download it — rotation preserves quality.

Range field skipped some pages

Why: Reversed or out-of-bounds range.

Fix: Use ascending order like "5-10".

A PDF reader still shows the old orientation

Why: The reader cached the previous render.

Fix: Close and reopen, or try another reader.

Preview updates slowly on a big PDF

Why: Re-rendering uses browser memory.

Fix: Use the bulk selectors instead.

A password-protected PDF won't rotate

Why: Some password-protected or encrypted PDFs cannot be opened by the browser PDF libraries.

Fix: Unlock it first, then upload the unlocked copy.

Getting every page upright without redoing it

A working order that avoids the most common redo.

Rotate before you merge or organize

Fix orientation first — a merged file built from mixed-orientation sources will carry that mix into the final document.

Use All Pages for a uniformly wrong scan

If every page has the same orientation problem, select All Pages and apply the rotation once instead of repeating it page by page.

Check the first and last page before exporting

Scroll the grid to both extremes to confirm the rotation landed correctly everywhere, not just where you were looking.

Keep the original as a fallback

Rotation always writes a new file and never touches your source — hold onto the original in case you want to try a different combination.

Use Portrait/Landscape for a mixed file

When some pages are already correct and others aren't, the orientation buttons touch only the mismatches — no manual sorting needed.

Compress afterward if size matters

Rotation preserves original content but doesn't shrink the file — run the export through Compress PDF before emailing or uploading it.

Rotate PDF — common questions

If something's not covered here, the troubleshooting section above likely has it.

Is it safe to upload my documents?

Yes. The PDF is processed in your browser using pdf.js and pdf-lib. This page does not upload the selected PDF to an AllInOneTools processing server.

Can I rotate only specific pages?

Yes. Select Specific Pages and type page numbers or ranges like 1, 3-5, 8, or hover any page in the grid and click its own rotate buttons.

Does rotating a PDF reduce its quality?

No. Rotation changes only the page's orientation metadata — the text, images, and vectors on the page are not re-compressed or altered.

What does Set Orientation do?

It rotates only the pages that don't already match the orientation you pick. Choosing Landscape turns portrait pages 90 degrees and leaves already-landscape pages alone.

Does this work on mobile?

Yes, the layout adapts to small screens and works in any current mobile browser.

Can I rotate every page at once?

Yes. Select All Pages and click a rotation button — every page gets the same rotation in one click.

What's the difference between Left 90°, Right 90°, and Flip 180°?

Left 90° turns counter-clockwise, Right 90° turns clockwise, and Flip 180° turns a page upside-down. Clicking a button repeatedly stacks the rotation — two Right 90° clicks equal one 180° flip.

Build notes

The write-up on how this was built

Because per-page and bulk rotation logic both run client-side, I wrote up the implementation — how orientation is detected, how stacked rotations are tracked, and how pdf-lib writes the final rotation value per page.

Published on freeCodeCamp

How to Build a Browser-Based PDF Rotator Using JavaScript

Covers pdf-lib's rotation API, orientation detection, and client-side document processing without a server round-trip.

Read the write-up on freeCodeCamp

Written by Bhavin Sheth · Founder, AllInOneTools