Skip to content
DevToolKit

PDF Deskew

Straighten tilted or skewed PDF pages with automatic angle detection and a manual fine-tune slider. All processing runs locally — never uploaded.

pdf

Drop your PDF here, or click to browse

Files are processed entirely in your browser — never uploaded

Processed locally
Was this tool helpful?

How to Use

Straighten a skewed PDF in four steps:

  1. Upload your PDF -- Drag and drop a PDF file or click the dropzone to browse. The tool renders the first page locally and shows it in the Before pane. Nothing is uploaded to any server.
  2. Auto-detect the skew -- Click "Auto-detect skew" to measure the page tilt. The detected angle appears as a badge (for example, +2.35° clockwise) and the correction is applied to the angle slider and the After preview automatically.
  3. Fine-tune if needed -- Drag the manual slider between -15° and +15° in 0.1° steps. Positive values rotate the content clockwise, negative values counterclockwise. The After preview updates live so you can judge the result visually before committing.
  4. Choose scope and download -- Apply the same correction angle to every page or to page 1 only, then click "Straighten PDF". The output file preserves your original page size and downloads as name-deskewed.pdf.

Everything runs in your browser using PDF.js for rendering and pdf-lib for the page rotation. This makes the tool safe for confidential contracts, medical records, and unpublished manuscripts.

About This Tool

Deskewing is the process of rotating a document image by a small angle so that its text lines run perfectly horizontal again. Scanners, photocopiers, and phone cameras routinely introduce tilt of 0.5° to 5° when a page feeds through slightly crooked. Even a 1° skew is noticeable to readers and measurably degrades OCR accuracy -- research on document analysis consistently shows recognition rates dropping as skew grows, because text segmentation algorithms assume horizontal baselines.

This tool detects skew using the projection-profile method, a classic algorithm from document image analysis that needs no machine learning and no large dependencies. The rendered page is converted to grayscale, thresholded into an ink bitmap using Otsu's method, then swept across candidate angles from -15° to +15°. At each candidate angle the image is horizontally sheared and the row-by-row ink sums are measured. When the candidate matches the true skew, text lines collapse into a few high-contrast rows and the variance of the row sums peaks sharply. A coarse pass at 0.25° steps finds the neighborhood, then a fine pass at 0.05° steps refines the estimate -- the whole detection typically completes in under 200 milliseconds per page.

Correction is applied in vector form rather than by re-rendering pixels. Each corrected page is embedded into the output document as a PDF Form XObject and re-drawn with a rotation transform about the page center. Because the original content stream is reused verbatim, searchable text stays selectable, vector diagrams stay infinitely sharp, and embedded images keep their original compression. The page dimensions are unchanged; only the content orientation differs. Pages that do not need correction -- or that lack a content stream -- are copied into the output untouched, preserving annotations and links on those pages.

One inherent trade-off of any deskew operation is corner clipping. Rotating a rectangle inside its own bounds means the rotated corners extend past the page edge, and PDF viewers clip at the page boundary. For typical skews under 5° the clipped triangles at the corners are a few millimeters at most -- usually empty margin on scanned pages -- and the white background of the fresh page makes any uncovered corner areas invisible on scanned documents. If your scan has content running right up to the paper edge, compare the Before and After previews before downloading.

Why Use This Tool

Straightening a skewed PDF is worth the thirty seconds it takes in several common situations:

  • Before OCR -- Text-recognition engines segment pages into lines assuming they are horizontal. A 2-3° skew can cut OCR accuracy noticeably; deskewing first restores baseline assumptions and improves extraction quality.
  • Archiving scanned documents -- Batch scans from automatic document feeders often mix pages tilted left and right. A deskewed archive looks professional and reads comfortably on screen without constant head-tilting.
  • Print preparation -- Crooked scans reprinted for filing or signing look sloppy. Straightening produces clean, aligned output for physical records.
  • Forms and legal documents -- Signed contracts, applications, and official forms scanned at an angle can raise questions about document integrity in formal review; a straight copy avoids that friction.
  • Downstream PDF tooling -- Cropping, margin measurement, table extraction, and page-dimension analysis all work better on aligned pages, since their geometry assumptions hold.

Related tools: PDF Rotate turns pages in 90° steps for landscape/portrait fixes. PDF Crop trims margins once pages are aligned. PDF Scanner Effect adds a scanned look to digital PDFs. PDF OCR extracts searchable text from your now-straightened scans. PDF to Greyscale prepares scans for monochrome printing.

FAQ

How does automatic skew detection work?
The tool renders the first page, converts it to a binary ink map, and sweeps candidate angles from -15° to +15°. At each angle it measures the variance of the horizontal projection profile — when text lines align horizontally the variance peaks. This is the classic projection-profile method used by document imaging software, refined in two passes to 0.05° resolution.
Does deskewing rasterize or re-compress my pages?
No. Corrected pages are embedded as PDF Form XObjects and re-drawn with a rotation transform about the page center. Text stays selectable, vector graphics stay sharp, and embedded images keep their original compression.
What skew range is supported?
Automatic detection covers -15° to +15°, which handles virtually all scanner and photocopier misalignment. The manual slider also covers ±15° in 0.1° steps for cases where you want to set the angle yourself.
Can I straighten only one page of a document?
Yes. The scope selector lets you apply the correction to all pages with the same angle, or to page 1 only. Pages that are not corrected are copied into the output file unchanged.
Is my PDF uploaded to a server?
No. Rendering, angle detection, and PDF rewriting all run locally in your browser using pdfjs-dist and pdf-lib. Your document never leaves your device.