🍱 Lunchbox Hands

PDF to Text

Extract text from any PDF in your browser. Scanned PDFs are OCR'd automatically, page by page. Nothing is uploaded.

Pull the text out of a PDF and get it as plain text you can copy or save as a .txt file. Most PDFs made from a word processor have a text layer, and that text is read straight from the file. Scanned pages have no text layer, so this tool notices that and runs OCR on just those pages. Each page in the result is labeled so you know which method was used.

It all happens in your browser. Your PDF is not uploaded. OCR accuracy depends on the scan: clean, straight, high-contrast pages read well; faint photocopies, handwriting and skewed phone photos do not.

Drop a PDF here or click to choose one

Text layer vs. OCR

A PDF page can carry real characters (a text layer) or just an image of a page. When a page has a text layer, the tool asks pdf.js for each run of text and its position, groups runs that sit on the same baseline into a line, and adds spaces where the gap between runs looks like one. That is fast and exact, as long as the PDF stores proper character codes.

If a page yields fewer than 20 non-space characters, it is treated as a scan: the page is drawn to a canvas at 2x scale and handed to Tesseract, an open-source OCR engine. OCR pages show a confidence score. Anything under 60% is worth checking against the original.

Limits worth knowing

  • Multi-column pages and tables may come out in an order you did not expect. The text is all there, but you may need to rearrange it.
  • Password-protected PDFs cannot be opened here. Use Unlock PDF first if you know the password.
  • Very large scanned PDFs are slow, because OCR runs one page at a time on your own device. Process them in page ranges.
  • Handwriting, stamps and very small print are mostly beyond what Tesseract can read.

Related tools

Frequently asked questions

Why does text copied from my PDF come out as gibberish?

Usually one of two things. Either the PDF is a scan, so each page is a picture and there is no real text to copy, or the PDF uses embedded fonts without a ToUnicode map. In the second case the file stores glyph numbers that only make sense to that font, so copying gives you random symbols even though the page looks fine. This tool handles both: scanned pages are sent to OCR automatically, and for garbled text layers you can turn on "Always OCR" so the page is read from its pixels instead.

How can I tell a text PDF from a scanned one?

Try selecting a word in your PDF viewer. If you can highlight individual words, there is a text layer. If the whole page highlights as one block, or nothing highlights, it is a scan. This tool also tells you per page: each result is marked "Text layer" when the text came straight from the file, or "OCR" when the page had fewer than 20 non-space characters and had to be read as an image. Mixed files, like a typed report with scanned signatures pages, are common.

Is my PDF uploaded anywhere?

No. The PDF is opened by pdf.js inside your browser, and OCR runs in a browser worker using Tesseract compiled to WebAssembly. The OCR engine files are served from this site, and the language model for the language you pick is downloaded from the jsDelivr CDN the first time you OCR a page. Those downloads are the engine and its data; your PDF and its pages never leave your device. The only other request is an anonymous usage count when you press Extract.

Which OCR languages are supported?

English, Spanish, French, German, Portuguese and Italian. The language setting only matters for OCR pages. Text-layer pages are copied out exactly as stored, in whatever language or script they use. Pick the language that matches the scan before you start, because a wrong choice hurts accuracy a lot, especially with accented letters. Each language model is a separate download of a few megabytes, cached by your browser after the first use.

Why is OCR so slow on big PDFs?

OCR works one page at a time. Each scanned page is rendered at twice its normal size so the engine has enough detail, then every line of pixels is analyzed. That takes a few seconds per page on a typical laptop and longer on phones, so a 200 page scan can take many minutes. The first OCR page is also slower because the engine and language model download. Use the page range box to do a few pages at a time, and Cancel stops after the current page.

How do I fix text that comes out in the wrong order?

This tool reads each page top to bottom and left to right by line. Two-column layouts can therefore interleave the columns, and tables come out as rows of words without cell borders. For text-layer pages, try "Always OCR": the OCR engine detects text blocks and often reads columns in a more natural order. Paragraph mode helps when every line ends with a hard break. For complex tables, the output usually still needs some hand editing.

Get weekly dev tools and tips