How to extract text from a PDF (and when you can't)
Pull the text out of a PDF as plain text, understand why scanned PDFs give nothing, and clean up broken lines and spacing before reusing it.
· 6 min read
A PDF does not store a document's text the way a word processor does. It stores fragments — a run of characters, a font, an encoding, and coordinates on the page — and nothing records the order a human would read them in. Extracting text means reading every fragment, then reassembling lines and paragraphs from where those fragments sit on the page. That reconstruction is usually right and occasionally wrong, which explains most of what surprises people about the result.
The quickest route here: drop your file into PDF to Text, tick Add page separators if you want to know which page each passage came from, and click Extract text. You get the text in a box with its word count, ready to copy or download as a .txt file. The PDF is read in your browser, so a contract or a medical report never leaves your device. What this tool cannot do is invent text that is not there: a scan contains pictures of letters, not letters.
The three ways to get the text out
| Method | Good for | Watch out for |
|---|---|---|
| A browser tool like this one | Any device, whole documents at once, plain text you can paste anywhere | Layout is not preserved; no OCR for scans |
| Desktop software (Poppler, LibreOffice Draw, Acrobat, Tesseract) | Scripting, keeping column layout, OCR on scans | Installation, and a command line for the best options |
| Built-in OS features | A paragraph or two you can select by hand | Selecting across pages is fiddly and drops line breaks |
On macOS, Preview does the simple case well: open the PDF, ⌘A then ⌘C copies the page's text. Recent versions can also select text inside a scanned page using Live Text, which is genuine on-device recognition — useful for a paragraph, tedious for a report. On Windows, Edge opens any PDF and lets you select and copy; recent Windows 11 builds add "Text actions" in the Snipping Tool, which reads text out of a screenshot. On iPhone, long-press in Files or Books to select text, and Live Text handles scanned pages the same way it does photos. On Android, the most reliable free OCR route is Google Drive: right-click the PDF, choose Open with → Google Docs, and Drive returns a document with the recognised text at the top.
For anything repeatable, Poppler's pdftotext -layout file.pdf out.txt is the reference: -layout keeps columns roughly where they were instead of flattening everything into one stream. LibreOffice Draw opens a PDF and lets you copy text block by block. Tesseract is the standard open-source OCR engine when there is no text layer at all.
Text PDF or scanned PDF?
Not every PDF contains text, even when it obviously looks like it does.
- Text PDFs come out of Word, Google Docs, a browser, an invoicing program. The letters are stored as characters, so they can be extracted exactly.
- Scanned PDFs are photographs of paper wrapped in a PDF container. What you read as letters is a grid of pixels. There is nothing to extract.
The five-second test: open the PDF in any reader — your browser is fine — and try to select a sentence with the mouse. If individual words highlight, there is a text layer. If you can only drag a rectangle across the whole page, it is a scan. Mixed files are common: a typed contract with a scanned signature page will give you everything except that page.
If it turns out to be a scan, this tool tells you no text layer was found rather than returning an empty box. Your options are to ask the sender for the original file — they usually still have the Word version — or to run OCR. Whatever engine you use, proofread the output: recognition errors cluster in small print, tables, stamps and handwriting, and a wrong digit in an amount is easy to miss.
What extraction does to the text
- Formatting is dropped on purpose. Bold, italics, headings, fonts, colours and images are not part of plain text.
- Line breaks come from the page, not the sentence. A paragraph that wrapped over six lines arrives as six lines, often with hyphenated words split across them.
- Tables become lines. Cells are emitted one after another; the content is all there, but the grid is gone.
- Columns follow position, not reading order. Two-column layouts, sidebars and text boxes can arrive interleaved.
- Headers and footers repeat. They are on every page, so they appear once per page in the output.
Clean it up before you reuse it
Pasting raw extracted text into a document usually looks wrong, and fixing it by hand is slower than it needs to be.
- Paste it into Text Cleaner to rejoin broken lines, remove double spaces and strip the leftovers of page layout.
- Delete repeated headers and footers yourself — a tool cannot always tell them from real content.
- Check the length with Word Counter, or Character Counter if you are working to a character limit.
How to clean text copied from a PDF goes through that clean-up step by step.
Common problems, and what they mean
The result is empty. No text layer: it is a scan, or the pages are images exported from a design program. OCR is the only route.
Strange characters, or letters missing entirely. Some PDFs embed fonts with non-standard encodings, so the character codes in the file do not map back to the letters you see. No extractor can fix that reliably; the original document is the dependable answer.
Only part of the text appears. The file mixes real text with pictures of text — a scanned annex, a screenshot, a logo with a slogan in it. Only the real text is returned.
Words are run together or split apart. Spacing in a PDF is often drawn as a gap between fragments rather than a space character. The reconstruction infers spaces from distance, and unusual typesetting confuses it.
"This PDF is password-protected." An encrypted file cannot be read until it is decrypted. Use Unlock PDF if you know the password; if you do not, no tool can legitimately open it.
Questions people ask
Does this do OCR? No. It reads the existing text layer only, and says so when there is not one.
Is my document uploaded? No. Extraction runs in the browser on your device, so the document itself never leaves it.
Can I get a Word file instead of plain text? Not from this tool. Plain text is the output; a converter that rebuilds formatting is a different job and tends to guess.
How do I compare two versions of a document? Extract both, then paste them into Text Diff to see what changed line by line.
Why is the word count different from the PDF's? Word counts differ between programs — hyphenated words, numbers and headers are counted differently. Treat the number as an estimate.
Next steps
- Tidy the extracted text: Text Cleaner
- Check its length: Word Counter, and the guide How to count words
- Compare two documents: Text Diff, and the guide How to compare two texts
Tools used in this guide
- PDF to Text (Extract Text from PDF)Extract the text of a PDF as plain text.
- Text CleanerFix broken lines, smart quotes, HTML and hidden characters.
- Word CounterCount words, characters, sentences and reading time as you type.
- Character CounterCount characters with and without spaces, emoji-aware.
- Unlock PDF (Remove Password)Remove a PDF's password when you know it.
- Text Compare (Diff Checker)Compare two texts and highlight the differences.