Quick answer
For searchable PDFs, the fastest method is `pdftotext input.pdf output.txt` (install: `brew install poppler` on Mac, `apt install poppler-utils` on Linux). Add `-layout` to keep the page's visual layout, which suits tables. For scanned PDFs containing only images, you need OCR — use `ocrmypdf input.pdf searchable.pdf` then `pdftotext searchable.pdf output.txt`. On a Mac, Preview can also copy the text of a searchable PDF with no install.
Method 1: Convert PDF to TXT online (free, in your browser)
- 1
Open the PDF to TXT converter
PDF.js reads the PDF inside your browser tab, so the document never leaves your device.
Go to converter - 2
Add the PDF
Drop the PDF on the page. Free: 2 files a day, up to 10 MB each. Pro: no daily limit, files up to 500 MB.
- 3
Text comes out in reading order
FormatDrop reads the PDF's text layer page by page. Two-column pages, such as papers and newsletters, are read one column at a time, while tables and forms keep their rows. Paragraphs and pages are separated by blank lines, and the file is UTF-8.
- 4
Download the TXT
Scanned PDFs have no text layer, so you get a message that OCR is needed instead of an empty file. TXT output has no watermark.
Convert PDF to TXT with pdftotext (best for searchable PDFs)
pdftotext is the standard command-line tool for PDF text extraction. Part of the poppler-utils package. Free, fast, and widely used in search and indexing tools.
- Install. Mac: `brew install poppler`. Linux: `apt install poppler-utils` or `dnf install poppler-utils`. Windows: download from poppler.freedesktop.org or use WSL.
- Basic extraction: `pdftotext input.pdf output.txt` — produces a UTF-8 text file with the PDF's text content in reading order.
- Keep the visual layout (best for tables and forms): `pdftotext -layout input.pdf output.txt` — keeps spacing close to the original and puts side-by-side columns next to each other on each line.
- Extract specific pages: `pdftotext -f 5 -l 10 input.pdf output.txt` — pages 5 through 10.
- Force a specific encoding: `pdftotext -enc UTF-8 input.pdf output.txt` (default is usually UTF-8 on modern systems).
- Pipe to other tools: `pdftotext input.pdf - | grep -i 'invoice'` — extract and filter in one shot. The `-` means write to stdout.
Note: pdftotext is the right tool most of the time. It only fails on scanned PDFs (no text layer to extract) and PDFs with unusual font embedding (rare). For everything else, it's fast, accurate, and produces clean output.
Convert PDF to TXT with Python pdfplumber (best for tables and structured PDFs)
pdfplumber is a Python library that excels at PDFs with tables, columns, and structured layouts. Built on pdfminer.six but with a much more usable API. Best when you need programmatic control over what you extract.
- Install: `pip install pdfplumber`.
- Basic extraction: `import pdfplumber; with pdfplumber.open('input.pdf') as pdf: text = '\n'.join(p.extract_text() for p in pdf.pages); open('output.txt','w').write(text)`.
- Extract page by page with metadata: `for page in pdf.pages: print(f'=== Page {page.page_number} ==='); print(page.extract_text())`.
- Extract tables specifically: `for page in pdf.pages: for table in page.extract_tables(): print(table)` — returns lists of lists you can write to CSV.
- Filter text by position (e.g., skip headers and footers): `text = page.crop((0, 50, page.width, page.height - 50)).extract_text()`.
- For LLM workflows, combine with chunking: split the extracted text into 1000-token chunks for embedding generation.
Note: pdfplumber is slower than pdftotext but produces better results for complex layouts. Use it when pdftotext mangles tables or column order. For pure speed on simple PDFs, stick with pdftotext.
OCR a scanned PDF to extract text (when pdftotext returns empty)
If pdftotext produces an empty file, your PDF is scanned (just images of text). You need OCR to recognize the characters. The best free toolchain is ocrmypdf (which handles the PDF wrapping) + Tesseract (the OCR engine).
- Install. Mac: `brew install ocrmypdf tesseract`. Linux: `apt install ocrmypdf tesseract-ocr`. Windows: WSL or download from github.com/ocrmypdf/OCRmyPDF.
- Add an OCR text layer to a scanned PDF: `ocrmypdf input.pdf searchable.pdf`. The output is the same PDF visually, but with hidden text behind each image character.
- Then extract text normally: `pdftotext searchable.pdf output.txt`.
- For multi-language documents: `ocrmypdf -l eng+fra+deu input.pdf searchable.pdf` (English, French, German simultaneously). Available languages: `tesseract --list-langs`.
- If your scan quality is poor, add deskew and denoise: `ocrmypdf --deskew --clean input.pdf searchable.pdf` — helps with crooked or noisy scans (--clean needs the unpaper tool).
- For huge batches: `for f in *.pdf; do ocrmypdf "$f" "${f%.pdf}-searchable.pdf" && pdftotext "${f%.pdf}-searchable.pdf" "${f%.pdf}.txt"; done`.
Note: OCR accuracy depends heavily on input quality. Sharp 300 DPI scans give the best results; blurry phone photos give many more errors. For mission-critical accuracy, use a commercial OCR service like Adobe Acrobat OCR or Google Document AI; for everyday use, Tesseract is excellent and free.
Extract text on macOS using built-in tools (no install)
macOS has decent PDF text extraction built in via Quartz (Apple's PDF engine). No third-party install required. Works for searchable PDFs only.
- Open Automator → New → Quick Action.
- Set 'Workflow receives current' to PDF files in Finder, then add the built-in 'Extract PDF Text' action. Set the output to Plain Text and choose where to save it.
- Save the Quick Action as 'PDF to TXT'.
- In Finder, right-click any PDF → Quick Actions → PDF to TXT. The .txt file appears next to the PDF.
- Alternative: the Shortcuts app's 'Get Text from PDF' action does the same job and can be run from Finder.
Note: macOS's built-in extractor is convenient but produces less consistent layout than pdftotext. For one-off use, it's fine; for repeatable workflows, install pdftotext.
PDF to TXT online without installing anything
If you can't or don't want to install command-line tools, browser-based converters work. Choose carefully — most send your PDF to a server.
- Server-based conversion (faster for large PDFs but uploads your file): smallpdf.com, ilovepdf.com, cloudconvert.com.
- For each: drop the PDF, choose TXT or 'Extract Text', download the result.
- Verify the output looks right by opening in a text editor. Compare a few sentences with the source PDF to catch encoding bugs (mojibake from wrong codepage).
Note: For sensitive PDFs (legal documents, medical records, financial data), only use command-line or other on-device extraction. Online services keep uploaded files on their servers for a while, often an hour or more.
When you need to convert PDF to TXT
- 1
Feeding PDFs to an LLM (Claude, GPT, Gemini)
LLMs consume text, not PDFs. Extract with pdftotext (fast) or pdfplumber (better for tables), chunk the result into context-window-friendly sizes, and feed to the model. For RAG pipelines, this is the canonical first step.
- 2
Building a search index over a document corpus
Elasticsearch, Solr, Meilisearch, and every other search engine index plain text. Extract once at ingestion time, store the .txt alongside the PDF, point your indexer at the .txt files. Searchable in milliseconds even for million-document corpora.
- 3
Migrating a PDF library to a wiki, CMS, or knowledge base
Notion, Confluence, Outline, and most wikis import .txt or Markdown but not PDF. Bulk-extract your PDFs to TXT, optionally convert TXT to Markdown with a script, then bulk-import to the destination. Migrating thousands of pages becomes scriptable instead of manual.
- 4
Compliance and content moderation scanning
Extract every PDF in a corpus to TXT, then run regex or NLP scanning for sensitive patterns (PII, credit cards, restricted terms). The text-based pipeline is much faster than visual analysis and integrates with existing data-loss-prevention tools.
- 5
Academic and research analysis
Bulk download papers from arxiv or a journal corpus, extract to TXT, run citation analysis, topic modeling, or term frequency analysis with Python (NLTK, spaCy). Many academic NLP pipelines start this way.
Troubleshooting common PDF to TXT problems
pdftotext outputs an empty file or just whitespace
Your PDF is scanned — it contains images of text, not text. pdftotext extracts only the text layer, which doesn't exist in scanned PDFs. Solution: run OCR first using ocrmypdf (Method 4 above), then pdftotext on the resulting searchable PDF. Verify by opening the original in any PDF viewer and trying to select text — if you can't select, you need OCR.
Multi-column PDF text comes out interleaved (line 1 col A, line 1 col B, line 2 col A, ...)
That usually means `-layout` (or `-raw`, which keeps the PDF's internal order) was used. Run plain `pdftotext input.pdf output.txt`: its default mode reads columns one after another. If a page still mixes them, crop each column with pdfplumber's `crop()` and extract them separately.
Special characters appear as ? or boxes (mojibake)
Encoding issue. Force UTF-8: `pdftotext -enc UTF-8 input.pdf output.txt`. If that doesn't help, the PDF may use a custom encoding or embedded CMap that pdftotext can't decode. Try pdfplumber instead, which uses pdfminer's more capable encoding handler. As a last resort, OCR the PDF — OCR ignores the original encoding entirely and recognizes characters visually.
Tables come out as garbled space-separated columns
Tables are PDF's worst format because they're just positioned text — there's no actual table structure in the PDF binary. Solutions: (1) Use `pdftotext -layout` to preserve approximate spacing. (2) For real tables, use tabula-py or camelot — both extract tables to CSV. (3) For LLM consumption, pdfplumber's `extract_tables()` returns clean Python lists you can format however you need.
Footnotes and headers appear inline with body text
PDFs don't distinguish footnotes from body text in their text streams — it's all positioned text. Filter by position: pdfplumber's `crop()` method lets you exclude top and bottom margins. Or post-process with regex to remove lines matching footnote patterns (e.g., starting with a number followed by a tab).
Large PDF (1000+ pages) takes forever or runs out of memory
Process page-by-page rather than all at once. With pdftotext: `for i in $(seq 1 1000); do pdftotext -f $i -l $i input.pdf page-$i.txt; done`. With pdfplumber: open in a `with` block and process pages in a generator, never holding the whole document in memory.
Text is in the wrong order (later page text appears earlier)
Some PDFs have unusual page rotations or layered content. Try `-layout` mode. If that doesn't help, the PDF may use an unusual reading order tagged in its accessibility metadata — pdftotext respects that, but you may need to extract by visual position using pdfplumber's bounding-box methods. For RTL languages (Arabic, Hebrew), use `pdftotext -enc UTF-8` and ensure your editor handles RTL.
Why convert PDF to TXT?
PDF-to-TXT is one of the most common PDF processing tasks and the foundation of every document data pipeline. Search indexers run it. RAG systems run it. Compliance scanners run it. Migration tools run it. The conversion is mostly easy — for searchable PDFs, `pdftotext input.pdf output.txt` does it in milliseconds.
The only catch is scanned PDFs, which contain only images of text. Those require OCR (Optical Character Recognition) to extract anything meaningful. The free Tesseract + ocrmypdf toolchain handles most everyday OCR. Commercial services (Adobe Acrobat Pro, Google Document AI) can do better on poor scans, at a per-page cost.
The other catch is layout. PDFs don't actually have 'columns' or 'tables' — they have positioned text that visually looks structured. Multi-column PDFs need care: pdftotext's default mode reads the columns one after another, while `-layout` keeps them side by side on each line. Tables come out as space-separated text instead of CSV. For programmatic table extraction, tabula or camelot are the right tools; for flowing text in columns, plain pdftotext works best.
Whatever your use case — LLM context, search index, knowledge base migration, compliance scan — start with pdftotext, fall back to pdfplumber for complex layouts, add ocrmypdf for scans. That covers virtually every PDF-to-TXT scenario.
Your files never leave your device
FormatDrop runs the conversion engine entirely inside your browser using WebAssembly. No file upload. No server. Nothing stored. You can verify this by opening DevTools → Network tab and watching: zero upload requests.
Frequently asked questions
Is converting PDF to TXT free?
Will text extraction work on a scanned PDF?
Best command-line tool for PDF to TXT?
How do I handle a multi-column PDF?
Will my PDF tables convert correctly to TXT?
Can I extract text from a password-protected PDF?
Does converting PDF to TXT preserve formatting?
What's the difference between pdftotext and pdfplumber?
How do I OCR a PDF for free?
No account. No upload. Works in any browser.