Straighten a scan that came out crooked

A page fed through a scanner at an angle is readable and looks wrong, and everything downstream — recognition, table extraction, cropping — does worse on it. This measures the tilt of the text lines on each page and rotates the page back to level. The price is worth knowing before you start: a corrected page is redrawn as a picture, because straightening means resampling the ink, so any text layer on that page is lost. Pages that are already straight are copied across untouched and keep everything they had.

A corrected page becomes an image. Text on it stops being selectable and searchable and a screen reader finds nothing there. This is unavoidable: turning the ink means redrawing it.

Straighten a scan

No account. Your upload is deleted after 2 hours, the result after 24 hours.

How it works

  1. Upload the crooked scan. One PDF. If only part of it is crooked, set the page range now: a page left out is copied across exactly as it was, text layer, sharpness and all.
  2. Set how far it should look, and how sharp the result should be. Up to 10 degrees at 200 dpi covers an ordinary sheet-fed scanner. Raise the resolution for small print; widen the angle only when the pages are visibly more than a few degrees out.
  3. Compare the corrected pages against the original. The notes say which pages were turned and by how much. A page moved by a tenth of a degree was straight enough already; a page moved by nine degrees is worth a look, because dense tables and heavy rules can fool the measurement.

What the options do

The form above lists the options this tool is running today, straight from the server. This is what they are for.

Largest tilt to look for (degrees)
The range the search covers either side of level. A sheet fed through a scanner is rarely more than two or three degrees out, so 10 is already generous. Widening it does not make the measurement more accurate — it makes the search slower and gives a page of tables or a form full of rules more room to be measured wrongly, because to the ink profile those look exactly like text lines.
Resolution of the corrected pages
The dpi corrected pages are redrawn at, which is also what decides the size of the file that comes back. 200 keeps ordinary print readable, 300 earns its place for small type and footnotes, and above that you are mostly buying megabytes. It applies only to the pages that actually needed correcting.
Pages to straighten
Which pages to look at. Everything left out is copied across as it stands, so it keeps its text layer and its sharpness. On a mixed document — a typed report with six scanned exhibits at the back — naming just the exhibits is far better than running the whole file through.

What this tool does not do

  • A corrected page becomes an image. Text on it stops being selectable and searchable and a screen reader finds nothing there. This is unavoidable: turning the ink means redrawing it.
  • It does not put a sideways page the right way up. Ninety or a hundred and eighty degrees is a rotation rather than a skew — use rotate for that, and run it first.
  • It measures text-like structure, so it needs some. A page that is mostly a photograph, a plan or a signature has nothing to measure and is usually left alone.
  • It does not crop, remove speckle, whiten a grey background or square up a page photographed at an angle. A phone photo of a document is perspective distortion, which no rotation can undo.
  • Form fields, annotations and links on a corrected page do not survive the redraw.

What happens to your file

The file is uploaded because Deskew PDF runs on our server rather than in the browser tab. It is kept for at most 2 hours and the result you download for 24 hours, then a scheduled job deletes both — a job has to be able to read the file while it runs, and you have to be able to retry a failed conversion without re-uploading. Neither needs longer.

Nothing about the contents is logged, and no one reads your documents. The retention page lists the same numbers the code enforces, and the privacy policy says who can reach the storage they sit in.

Questions

How does it work out the angle?
By squashing the page’s ink onto the vertical axis and counting how much lands on each row. When the lines are level, rows are either dense with ink or empty and the counts vary wildly; tilt the page and every line smears across several rows and the counts flatten out. The angle with the most variation is the angle the text is really sitting at.
Will my searchable PDF stay searchable?
Only on the pages it does not touch. A corrected page is a picture, so its text layer is gone. If the document matters, straighten it first and have it recognised afterwards — the OCR check here will tell you which pages ended up needing it.
Nothing changed and my pages are still crooked.
Either the tilt is outside the range you set, or the page has too little text-like structure to measure. Widen the angle first; if that does not help, the page is probably too sparse or too graphical for this method.
The file came back much larger.
Corrected pages are stored as images, and an image of a page is bigger than the instructions for drawing one. Lower the resolution, narrow the page range, or run the result through compress.
Can it fix a photo of a document taken at an angle?
No. In a photograph the page is a trapezium rather than a tilted rectangle, and rotating it cannot make the near edge and the far edge the same length. Rescan it flat, or use a phone scanning app that lets you drag the corners.