Auto-rotate scanned PDF pages
Auto-rotating a scanned PDF detects each page's true orientation automatically: the page is OCR-read at 0, 90, 180, and 270 degrees, and the rotation that produces the most confidently recognized text wins. A page is only rotated when one orientation is clearly more legible than the current one, so correct pages are left alone. This page runs the whole check on your device — the scan is never uploaded.
How it works
A scanned page carries no orientation information — it is just an image, and an upside-down image is structurally identical to an upright one. Software can only tell them apart the way a human does: by checking which way up the text reads. This tool makes that check literal. Each page is rendered to a bitmap, and an OCR engine (Tesseract, compiled to WebAssembly) attempts to read it four times — at 0, 90, 180, and 270 degrees. Every attempt returns a mean recognition confidence: upright English text scores high, while rotated or inverted text decodes into low-confidence gibberish.
The four scores then vote. The winning rotation is applied only when it beats the upright reading by a clear margin — a deliberate bias that prevents the tool from "fixing" pages that were already correct just because two orientations scored similarly. The fix itself is applied by setting the page's /Rotate value in the output PDF, a lossless metadata change; the scan image is never resampled, so quality is untouched.
The approach has honest limits. Detection uses the English trained model (about 11 MB, downloaded once on first use and cached — your PDF itself never leaves the device), so pages in non-Latin scripts such as Arabic, Hebrew, or Chinese may score low in every orientation and be left unchanged. The same goes for photos, diagrams, and blank pages: no text, no vote. And because every page costs four OCR passes, detection is capped at the first 20 pages to stay responsive in a browser. If you already know the pattern of the problem, a deterministic tool is faster: rotate PDF pages for whole-file or selected-page turns, or rotate alternate pages when exactly every second page is flipped.
Illustrative example: a 14-page mixed-orientation scan
Illustrative scenario, not a recorded benchmark. File sizes, timings and results depend on the input and device. Try the reproducible samples.
A shared office scanner produced a 14-page, 9.2 MB PDF from a stack of loose paper: eleven pages fed upright, two landscape pages fed sideways, and one sheet inserted upside down. On first use the tool fetches the 11 MB English model, then renders and reads each page at four rotations — about 75 seconds total on a mid-range laptop.
The verdict per page: pages 4 and 9 score 91% and 88% confidence at 270 degrees against 12% and 15% upright, so they are rotated; page 12 scores 90% at 180 degrees against 9% upright and is flipped. The other eleven pages score highest at 0 degrees and are untouched. The output is the same 9.2 MB — only three /Rotate values changed, no pixels were re-encoded — and every page now reads the right way up.
Frequently asked questions
How does the tool know a scanned page is upside down?
It runs OCR on the page image at 0, 90, 180, and 270 degrees and compares the recognition confidence of each attempt. Upside-down text produces near-gibberish with low confidence, so the correct orientation scores clearly higher and wins the vote.
Why does the first run download an 11 MB file?
The OCR engine needs a trained English language model, which is about 11 MB and is fetched once on first use. Your PDF itself is never uploaded; only the model is downloaded, and it is cached for later runs.
Does auto-rotate work on pages in Arabic, Chinese, or other non-Latin scripts?
Detection uses the English recognition model, so pages in non-Latin scripts may score low in every orientation and be left unchanged. Photos, drawings, and blank pages without text are skipped for the same reason.
Why does the tool only check the first 20 pages?
Each page is rendered and OCRed at four rotations, so detection cost grows quickly with page count. Capping detection at 20 pages keeps the run fast in a browser; for longer files, process them in sections.
Will a correctly oriented page ever be rotated by mistake?
The tool is deliberately conservative: a rotation is applied only when its confidence clearly beats the upright reading, not merely ties it. Ambiguous pages are left exactly as they were.