PDF to Text: How to Extract Text from Any PDF for Free
Quick summary: To extract text from a PDF, open it in any viewer and press Ctrl+A to select all, then Ctrl+C to copy — paste into any text editor to get the plain text. For scanned PDFs (images with no selectable text), use our AI tool above to extract text automatically, or run OCR with a free tool. On the command line,
pdftotext input.pdf output.txtconverts the entire file in one step.
Converting a PDF to text lets you paste the content into a document, run a search, feed it to another tool, or simply read it without the PDF viewer. Our free AI PDF reader extracts and analyzes text from any PDF — including scanned documents — without requiring any software install.
Method 1: Copy and paste (fastest, works everywhere)
If the PDF contains real text (not a scanned image), this takes seconds:
- Open the PDF in any viewer — Preview (Mac), Edge (Windows), Chrome, or Acrobat Reader.
- Press Ctrl+A (Windows) or Cmd+A (Mac) to select all content on the current page.
- Press Ctrl+C / Cmd+C to copy.
- Open any text editor (Notepad, TextEdit, VS Code, Google Docs).
- Press Ctrl+V / Cmd+V to paste.
To extract all pages: In most viewers, Ctrl+A selects all text in the entire document, not just the visible page. If not, scroll through and repeat per page.
Limitation: Formatting — columns, tables, headers — is often lost. The text pastes in reading order, which may not match the visual layout of multi-column PDFs.
Method 2: Export as text from Preview (Mac)
- Open the PDF in Preview.
- Select all text: Edit → Select All (Cmd+A).
- Copy (Cmd+C) and paste into TextEdit or any other app.
Preview does not have a native “Export as .txt” option, but the copy-paste approach above is equivalent.
Method 3: pdftotext command line (Mac, Windows, Linux)
pdftotext is part of the free Poppler utilities and extracts text in one command:
Install on Mac:
brew install poppler
Install on Windows: Download the Poppler Windows build and add it to your PATH.
Convert a PDF to a .txt file:
pdftotext input.pdf output.txt
Preserve layout (approximate columns):
pdftotext -layout input.pdf output.txt
Extract a single page:
pdftotext -f 3 -l 3 input.pdf page3.txt
Extract all pages into separate files:
for i in $(seq 1 $(pdfinfo input.pdf | grep Pages | awk '{print $2}')); do
pdftotext -f $i -l $i input.pdf page_$i.txt
done
pdftotext handles complex multi-column layouts better than copy-paste, because it uses the PDF’s internal coordinate system rather than a display rendering order.
Method 4: Python with PyMuPDF (for developers)
PyMuPDF (fitz) is a fast, free Python library:
pip install pymupdf
import fitz # PyMuPDF
doc = fitz.open("input.pdf")
text = ""
for page in doc:
text += page.get_text()
with open("output.txt", "w", encoding="utf-8") as f:
f.write(text)
For structured extraction (preserving block positions):
for page in doc:
blocks = page.get_text("blocks")
for block in blocks:
print(block[4]) # block[4] is the text content
Method 5: Scanned PDFs — AI and OCR
If the PDF is a scan (photographed pages), there is no text layer — copy-paste returns nothing. Options:
Use our AI PDF reader (no install)
Upload the PDF to our free PDF reading tool — it reads scanned documents using AI, extracts the text, and lets you copy, search, or ask questions about the content. No OCR software needed.
Run OCR locally
- macOS Ventura+: Preview can select text in scanned images — macOS has built-in OCR. Try clicking on the text in Preview.
- Tesseract (free, open source):
brew install tesseract→tesseract input.pdf output -l eng pdf— produces a searchable PDF with a text layer. - Adobe Acrobat: Tools → Enhance Scans → Recognize Text — the fastest desktop option, but Acrobat requires a subscription.
Text extraction quality: what to expect
| PDF type | Copy-paste | pdftotext | AI/OCR |
|---|---|---|---|
| Text-only (Word export) | Excellent | Excellent | Overkill |
| Mixed text + images | Good | Good | Good |
| Multi-column layout | Poor ordering | Good with -layout | Good |
| Tables | Structure lost | Structure lost | Varies |
| Scanned (image) | Nothing | Nothing | Required |
| Scanned + skewed/low-res | Nothing | Nothing | Reduced accuracy |
How to convert PDF to text online — free
Search for “PDF to text free” and choose any well-reviewed tool:
- Upload the PDF.
- Download the .txt file.
Privacy note: Your file is sent to a remote server. Use offline methods (copy-paste, pdftotext, PyMuPDF) for confidential documents.
Related guides
- How to search a PDF for free — find text without extracting it
- How to copy text from a PDF for free — copy individual sections
- How to edit a PDF for free — modify the text after editing
Frequently Asked Questions (FAQ)
Why does the extracted text have strange characters or symbols?
The PDF uses a font with a non-standard character encoding, or the font is embedded as a bitmap. pdftotext handles most standard encodings. If the output has garbled characters, try adding -enc UTF-8 to the command. For bitmap fonts, OCR is the only option.
How do I extract text from a specific page range?
With pdftotext, use -f (first page) and -l (last page): pdftotext -f 5 -l 10 input.pdf output.txt. With copy-paste, navigate to the page range and select manually with Shift+click.
Does extracting text preserve formatting (bold, italic, headings)?
Plain text (.txt) has no formatting — all text becomes flat. To preserve formatting, export to HTML or XML instead: pdftotext -htmlmeta input.pdf output.html, or use PyMuPDF’s HTML output mode: page.get_text("html").
How do I convert a scanned PDF to searchable PDF (keep the layout)?
Run Tesseract with PDF output: tesseract input.pdf output -l eng pdf. This produces a new PDF with an invisible text layer over the original images, making it searchable without changing the visual appearance.