Skip to content
WorldofPDFs

Straighten scanned pages that came out crooked

Measure how far a scanned page is tilted and rotate it level. A page that is a degree and a half off looks careless and, more importantly, reads badly to OCR — straightening it first is the cheapest accuracy improvement available.

Deskew PDF

projection-profile estimate · confidence gated

Ready

Loading tool…

How to Deskew PDF

  1. Add the scan. Drop the PDF in. A sample of pages is measured immediately and the detected tilt is reported.
  2. Choose how to correct it. One angle for the whole document suits a stack fed through a scanner. Measuring each page separately suits pages photographed one at a time.
  3. Adjust the angle if you need to. The measured figure is a starting point. Nudge it if the result is not quite level.
  4. Straighten and download. Save the corrected PDF.

How the tilt is measured

By projection profile, and understanding it explains what this tool can and cannot do. Take every dark pixel on the page and project it onto a vertical axis, counting how many land in each row. On level text the counts are violently uneven: dense bars where the lines of type are, near zero in the leading between them. Tilt the page and every line smears across many rows, and the profile flattens out.

So the method is to try a range of angles, score each by how spiky its profile is, and take the winner. It is measuring lines of text, which has a direct consequence: a page that is mostly photograph, or nearly blank, has no lines to measure, and the score barely moves between angles.

That flatness is detectable, and it is reported rather than hidden. A page whose measurement carries no confidence is left exactly as it is instead of being rotated by whichever angle noise happened to favour.

One angle, or one per page

A stack of paper fed through a sheet-fed scanner acquires one angle. The rollers grip slightly off-square and every sheet comes through the same way, so the pages share a tilt to within a fraction of a degree.

For that case a single measured correction applied to every page is both more accurate and far steadier than measuring each page alone — one figure taken from many pages averages out the pages that were hard to measure, where per-page correction would let each of those pages go its own way.

Photographing pages one at a time is the opposite: every page has its own angle and there is no shared figure to find. That is what per-page measurement is for. It is slower, since every page has to be rendered and analysed, and it skips any page it cannot measure rather than guessing.

If the sampled pages disagree with each other by more than a degree, the tool says so — that disagreement is the signal that no single angle will suit the document.

Straighten before running OCR

OCR engines segment a page into lines before they recognise any characters, and that segmentation assumes lines run horizontally. A tilt of two or three degrees is enough to make a line of text drift from the top of its band to the bottom across the width of the page, at which point the engine either splits it in two or merges it with its neighbour.

The recognition errors that follow look like character-level failures and are actually layout failures, which is why they are so resistant to being fixed by changing the OCR settings.

Straightening first is the fix, and it costs nothing in quality here because the correction is a transform rather than a re-render.

What the correction costs

Pages are rotated, not rasterised. The existing content — the scanned image, or the text if the PDF has one — is drawn through a rotation transform, so a scan keeps exactly the pixels it arrived with and a text document keeps selectable text. Nothing is decoded and re-encoded, so there is no generational quality loss.

The one visible cost is a slight shrink. Rotating a rectangle makes its bounding box larger in both directions — a 1.5° tilt on A4 needs about 2% more width and height than it started with — so each page is scaled down by that fraction to keep its corners on the sheet. The alternative is clipping the corners, which on a scanned page is where the page number and the margin notes live.

Frequently asked questions

How do I straighten a crooked scan?

Drop the PDF in. The tilt is measured automatically from a sample of pages, and you can apply that one angle to the whole document or have every page measured separately.

Why does my OCR keep getting things wrong on a tilted scan?

Because OCR finds lines of text before it reads characters, and that step assumes lines are horizontal. A couple of degrees is enough to make it split or merge lines, which shows up as unfixable character errors. Straighten first.

Will straightening reduce the image quality?

No. The page is rotated as a transform rather than re-rendered, so nothing is recompressed. Each page is scaled down by a fraction of a percent so its corners stay on the sheet.

What if a page is blank or is mostly a photograph?

It is left alone. The measurement works from lines of text, and a page with none of them gives an answer with no confidence behind it — so nothing is applied rather than a guess being made.

My page is sideways, not tilted. Will this fix it?

No. This corrects small angles, up to about ten degrees. A page that is ninety degrees out needs Rotate PDF.

Are my files uploaded?

No. The pages are rendered, measured and redrawn entirely in your browser.

Can I set the angle myself?

Yes. The measured figure fills in the box and you can change it — useful when a document has too little text for the automatic measurement to be certain.

Related tools