PDF to Text

Extract text from any PDF file directly in your browser. Copy the text to your clipboard or download it as a .txt file. No upload required.

This tool pulls the text layer out of any digitally-created PDF and hands it back as plain, copyable text. It runs Mozilla's PDF.js library (version 5.6.205, the same engine Firefox ships) entirely in your browser, so nothing is uploaded. Works on reports, ebooks, invoices, research papers, and any PDF that lets you highlight text in Adobe Acrobat or Preview. Scanned images without OCR will not produce text.

Ad
Ad

About PDF to Text

How Does PDF Text Extraction Work?

PDF.js parses the PDF's internal object tree, walks each page's content stream, and reads the positioned character sequences from the text layer. There is no retyping or OCR - the text is already encoded inside the file, just not in reading order.

StepWhat Happens
1. UploadSelect or drop a PDF file from your device
2. Parse structurePDF.js reads the document's internal object tree and page catalogue
3. Extract text layerEach page's TJ and Tj text-showing operators are read in order
4. Reconstruct linesCharacters are grouped into lines based on their XY position on the page
5. OutputText is shown page by page with "--- Page N ---" separators, ready to copy or download as .txt

Worked example: A 12-page research paper (PDF size 1.4 MB, text content only - no image figures) extracts in roughly 400-600ms on a modern laptop. The resulting .txt file is about 45 KB - roughly 30x smaller than the original because all the font, layout, and rendering data has been stripped out.

What Works and What Does Not

Extraction works on any PDF that has a real text layer. If you can select and highlight text with your cursor in a standard PDF viewer, this tool will extract it. Scanned pages, photos, and image-only PDFs will return nothing unless they have already been processed with OCR.

PDF TypeText Extractable?Example
Digitally created (Word, Google Docs, LaTeX)Yes - full textReports, letters, articles exported as PDF
Web page saved as PDFYes - full textBrowser "Print to PDF" output
Scanned document with OCRYes - from the OCR layerScanned pages run through Adobe Acrobat OCR or ABBYY FineReader
Scanned document without OCRNo - image onlyRaw scanner output with no text recognition
Image-only PDFNoPhotos or screenshots saved as PDF
PDF with embedded custom fontsUsually yesSome fonts with custom encoding may produce garbled characters
Password-protected PDF (view-only)Usually yesOpen-password PDFs can be extracted once the password is entered in the source app
Password-protected PDF (owner restrictions)DependsEdit/copy restrictions may block extraction

How Are Text and Images Stored in a PDF?

A PDF page has several independent streams. The text-showing operators (Tj, TJ, Tf for font, Td/Tm for positioning) describe every character and where it sits on the page. The image XObjects hold bitmap or JPEG data. The graphics state stack tracks colour, stroke, and transformation matrices. This tool reads only the text operators - it ignores images, vector graphics, and embedded fonts. That is why the output is plain text with no formatting.

PDF 2.0, formally ISO 32000-2:2020, added tagged PDF improvements in Clause 14.8 that make reliable text extraction easier. Tagged PDFs include logical structure (headings, paragraphs, lists, tables) so extraction tools can output reading order instead of visual order. Most PDFs in the wild are still untagged, which is why multi-column and complex layouts often come out jumbled.

What Are the Common Use Cases?

Use CaseWhy Extract?
Quoting content in a new documentCopy specific paragraphs without retyping
Full-text search across documentsExtract text to search it with grep, ripgrep, or spreadsheet filters
Feeding text into an LLMPaste extracted text into ChatGPT/Claude for summary, translation, or Q&A
Data processing in codeFeed extracted text into Python, R, or Node scripts for regex parsing or analysis
Accessibility conversionProduce a plain-text version that screen readers and braille displays handle more reliably
Content migrationMove content from legacy PDFs into a new CMS, wiki, or knowledge base
Translation preparationExtract text to paste into DeepL, Google Translate, or send to a human translator
Legal discovery and redactionScan extracted text for sensitive keywords before producing a redacted PDF
Regulatory archivingKeep a plain-text record of a PDF for long-term readability beyond any specific PDF viewer

If you need to go the other direction, the Text to PDF tool creates a clean PDF from plain text. For batch work, the Split PDF tool can break a large document into smaller files before extracting text from specific sections, and Merge PDF can combine several PDFs before a single extraction pass.

Output Quality Tips

Extraction quality depends almost entirely on how the PDF was authored. Well-tagged PDFs produced by modern Word or Google Docs extract cleanly. Older academic PDFs, scanned invoices, and multi-column magazine layouts tend to need manual cleanup.

IssueCauseWorkaround
Words run togetherPDF has no real space characters between positioned text itemsThe extractor inserts spaces based on character gaps, but complex layouts may need a search/replace pass
Columns are interleavedMulti-column PDFs store text in visual order, not reading orderExtract and manually separate the columns, or use a viewer that supports reading-order extraction
Headers/footers repeatHeaders and footers are part of the text layer on every pageUse find-and-replace to remove repeated strings, or delete the "--- Page N ---" sections you do not need
Special characters garbled (e.g. fi, fl ligatures)PDF uses a custom font encoding or CID mapping without a ToUnicode mapTry opening the PDF in a different viewer first to check if text is selectable; some PDFs need a round-trip through Acrobat
Mathematical formulas lostLaTeX and Word formulas are often rendered as vector images, not textManual retyping or a dedicated math-OCR tool like Mathpix
Tables lose their structurePDF tables are positioned text, not structured dataExtract the text and manually reformat, or use Tabula for dedicated table extraction
Hyperlinks strippedLinks are stored as annotations, not inline textAccepted limitation - the text layer does not carry link destinations

Is Browser-Based PDF Extraction Private?

Yes. Every operation happens inside your browser tab using PDF.js running as JavaScript. The file is loaded with File.arrayBuffer() into memory, parsed in place, and never sent to any server. The only network request the tool makes is for the PDF.js worker script from cdnjs.cloudflare.com, which is a static asset containing no user data. When you close the tab, everything is gone. This matters for medical records, legal discovery documents, HR files, financial statements, and anything else you would not send to a random cloud service.

By contrast, most online "PDF to text" converters require uploading your file to a third-party server. A 2024 Sucuri report noted that free online file-conversion sites are a common malware and data-harvesting vector, with some operators selling the uploaded documents as training data. Browser-only tools side-step that risk entirely.

Why Is PDF Text Extraction Hard?

PDF was designed in 1993 by Adobe to faithfully preserve visual presentation across devices. It became an open ISO standard in 2008 as ISO 32000-1:2008, and PDF 2.0 arrived in 2017/2020 as ISO 32000-2. The format was never built for semantic text - it was built for pixel-perfect printing. A paragraph in a PDF is not a "paragraph" object; it is a series of "place character X at position (120.5, 430.7) in font Helvetica at 11pt" operations. Reading-order reconstruction has to infer paragraphs, columns, and line breaks from those coordinates.

Three specific quirks make extraction imperfect:

  • No guaranteed spaces. Some PDFs insert a literal space character between words; others rely on character positioning, which the extractor has to detect by gap width.
  • Custom font encodings. A PDF can embed a font that maps character code 65 to "q" instead of "A" for DRM or compression reasons. Without a ToUnicode map, the text comes out scrambled.
  • Z-order is not reading order. A PDF can place text in any order on the page. Multi-column layouts, pull quotes, and sidebars often appear out of sequence in raw extraction.

Tips to Get the Cleanest Output

Before extracting, open the PDF in Acrobat or Preview and try to select a paragraph. If selection drags across unrelated columns or grabs page numbers, the text layer is in visual order and extraction will reflect that. A few practical habits help:

  • Start with the source PDF, not a printed-and-rescanned copy. Rescanned PDFs lose the original text layer and need OCR.
  • If the PDF was exported from a modern tool (Word 2019+, Google Docs, LibreOffice 7+), extraction quality is usually excellent. Older Acrobat Distiller output from the 2000s is the most likely to produce garbled characters.
  • Run a find-and-replace pass after download to strip repeated headers, footers, and page-number artefacts. A text editor with regex support handles this in seconds.
  • For scanned PDFs, run OCR in Adobe Acrobat or a free tool like OCRmyPDF first, then come back here to pull the clean text out.

For large batches, consider scripting the extraction with a server-side library such as pdfplumber (Python) or pdf-parse (Node) - but for one-off use or anything confidential, the browser-only approach is faster and safer.

Sources

Frequently Asked Questions

How does the PDF text extraction work?

The tool uses the PDF.js library (the same one Firefox uses) to parse the PDF structure and extract all text content. It processes each page in sequence and combines the results.

Can it extract text from scanned PDFs?

No. This tool extracts text that is digitally embedded in the PDF. Scanned documents are essentially images and would need OCR (optical character recognition) software to extract text.

Does the tool preserve formatting?

It extracts the raw text content from each page. Basic reading order is preserved, but complex layouts like multi-column pages or tables may not appear perfectly formatted in the output.

Are my files uploaded anywhere?

No. The entire extraction process runs in your browser. Your PDF never leaves your device.

Is there a page limit?

There is no hard limit. However, very large PDFs with hundreds of pages may take longer to process since everything runs locally in your browser.

Link to this tool

Copy this HTML to link to this tool from your website or blog.

<a href="https://toolboxkit.io/tools/pdf-to-text/" title="PDF to Text - Free Online Tool">Try PDF to Text on ToolboxKit.io</a>