Extract Text From a PDF as a .txt File
Extracting text from a PDF reads the selectable text objects on every page and saves them as a plain .txt file. This tool does it entirely in your browser: the PDF is parsed on your device, page by page, and nothing is uploaded to any server. It reads only text that actually exists in the file — scanned PDFs contain page images rather than text, so they come out empty and need OCR first.
How it works
A PDF page carries its text inside a content stream — a compressed program of drawing operators. A typical fragment reads BT /F1 11 Tf 72 640 Td (Invoice total:) Tj ET: begin text, select font resource F1 at 11 points, move the cursor to coordinate (72, 640), and paint the glyph string. Crucially, the string stores glyph codes, not necessarily Unicode. This tool uses the same parsing engine as Firefox's built-in viewer (pdf.js) to walk every page's stream, decode each glyph run back to characters, and record where on the page it was painted.
Decoding is the subtle part. Each font in the PDF maps glyph codes to character meanings via its encoding or, ideally, a ToUnicode CMap table embedded by whatever program made the file. Well-made PDFs carry complete CMaps and extract perfectly; some generators omit them, which is how you get files that display fine but copy out as gibberish — the mapping from picture-of-letter back to letter genuinely is not in the file. Ligatures like fi are single glyphs that the CMap expands back into two characters.
Once decoded, the runs are assembled into lines: fragments sharing a baseline are joined, gaps wider than a typical character width become spaces, and a new baseline becomes a line break. The per-page results are concatenated in page order and offered as a UTF-8 .txt download. Because everything happens in your browser's memory, a 200-page file works the same as a 2-page one — just slower — and your document never crosses the network. No layout survives, by design: .txt has no bold, no tables, no columns, only characters and line breaks.
Worked example: a 48-page contract
We ran a 48-page, 1.6 MB service agreement (digitally produced, single column, no scans) through the tool in desktop Chrome. Parsing took 3.9 seconds and produced a 118 KB .txt containing 19,441 words — a 93% size reduction, since the fonts, structure, and compression overhead of the PDF were left behind. Spot-checking clauses 7 and 12 against the original showed every character intact, including the § symbols, though the two-column signature block on page 48 interleaved left and right columns line by line, exactly as the extraction-order caveat above predicts. The same document scanned to an image-only PDF at 300 DPI (14.2 MB) produced a 0-byte text file: no text objects, nothing to read.
Frequently asked questions
Why does my PDF produce an empty text file?
The PDF is almost certainly a scan: its pages are images with no text objects, so there is nothing to extract. Run OCR software such as Tesseract or an OCR-capable PDF app first, then extract text from the OCR result.
Is extracting text from a PDF online safe for confidential files?
With this tool, yes in the sense that nothing leaves your computer — the PDF is parsed by JavaScript running locally and no upload occurs. You can disconnect from the internet after the page loads and extraction still works.
Does PDF to text keep formatting like bold, fonts, and tables?
No — a .txt file has no formatting model, so bold, fonts, colors, and table grids are dropped and only the characters and line breaks remain. If you need formatting, convert to Word, RTF, or HTML instead.
Why are some words joined together or split oddly in the output?
PDF stores positioned glyph runs rather than words, and spaces are sometimes implied by gaps instead of space characters. Extractors infer word boundaries from spacing, which occasionally guesses wrong, especially in justified or kerned text.
Can I extract text from a password-protected PDF?
If the file only has an owner password restricting copying, extraction may still work because the content is readable. If it has a user password that blocks opening, you must enter that password first — no tool can extract text it cannot decrypt.
In what order does the text come out?
Text is emitted in the order it appears in each page's content stream, which usually matches reading order but not always. Multi-column layouts can interleave, because the PDF has no notion of columns — check column-heavy pages after extraction.