Skip to main content
PDFBase

PDF to Text Converter

Local

Extract plain text from PDF files

All Tools
PDF to Text
Local
Tool Details
Input formatsPDF
Output formatTXT
Max file size50 MB
Max files1
ProcessingLocal

Privacy First

Your files are processed entirely in your browser. Nothing is uploaded to any server.

How do I extract the text from a PDF?

Load the PDF, decide whether you want a marker inserted between pages, and run the extraction to download a .txt file. The tool reads the document’s embedded text layer, groups the pieces back into lines by their position on the page, and orders them top to bottom. Extraction happens in your browser, so the PDF is never uploaded.

About the PDF to Text Converter

Extract clean, plain text from any PDF directly in your browser. Reading order and line breaks are preserved, and your file is never uploaded to a server.

  • Extract a contract, invoice or research paper as .txt for grep, diff, a spreadsheet import or a script that expects plain input.
  • Keep reading order intact: text items are grouped into lines by their y coordinate and sorted left to right, rather than dumped in the order the file happens to store them.
  • Insert an explicit marker between pages so a downstream script can split the output back into per-page chunks.
  • Copy text out of a PDF whose viewer blocks selection, without installing anything or uploading a confidential document.

How to use the PDF to Text tool

  1. 1

    Upload PDF file

    Select PDF file from your device or drag file into the upload area.

  2. 2

    Choose settings

    Choose settings such as Add a marker between pages before processing.

  3. 3

    Convert to TXT

    Run the PDF to Text tool to create the TXT output.

  4. 4

    Download the result

    Download the finished file. The original file stays on your device and is not uploaded.

How does this tool rebuild lines and reading order?

A PDF does not store paragraphs; it stores fragments of text at coordinates. This extractor reads the position of every fragment, groups fragments that sit at the same height into one line, sorts each line left to right, and then sorts the lines from the top of the page downwards. The result reads naturally for ordinary single-column documents. Multi-column layouts are the known weak spot: two side-by-side columns share the same heights, so their text can interleave.

Why does a scanned PDF produce an empty file?

Because there is nothing to extract. A scan is a photograph of a page wrapped in a PDF, so the words exist only as pixels and the document has no text layer at all. This tool reads text, it does not perform OCR, so a pure scan legitimately returns nothing. A quick check: open the PDF in any viewer and try to select a sentence with your cursor. If you cannot, no text-extraction tool can help until the file has been through OCR.

When should you turn on the page-break marker?

Turn it on when page boundaries carry meaning — quoting a source by page number, checking pagination, or splitting the output into per-page records later. Each page is then separated by a visible marker line instead of just a blank line, which is easy to split on programmatically. Leave it off when you want continuous prose to feed into a text editor, a translator, or a model prompt, where the markers are just noise.

Are my files uploaded when converting PDF to text?

No. The PDF is parsed by a JavaScript engine already loaded in this tab, and the extracted text is assembled into a file in memory before being handed to your browser’s downloader. That is a meaningful difference for the documents people usually want text out of — contracts, statements, research under embargo, internal reports — because there is no server that ever holds either the source or the extracted words.

Extract PDF text in code

All of these read the embedded text layer. None of them run OCR, so a PDF made of scanned images returns nothing — which is itself a useful signal that the document needs OCR before anything else will work on it.

Shell (poppler)

The reference implementation. -layout keeps columns and tables readable.

# macOS: brew install poppler   Debian/Ubuntu: apt install poppler-utils
pdftotext -layout contract.pdf contract.txt

# Pages 3 to 7 only, straight to stdout
pdftotext -f 3 -l 7 -layout contract.pdf -

Python (pypdf)

Pure Python, no system dependency.

# pip install pypdf
from pypdf import PdfReader

reader = PdfReader("contract.pdf")
text = "\n\n".join(page.extract_text() or "" for page in reader.pages)
open("contract.txt", "w").write(text)

Node.js (pdfjs-dist)

Sorting items by their transform is what turns a bag of fragments into readable lines.

import { getDocument } from "pdfjs-dist/legacy/build/pdf.mjs"
import { readFile } from "node:fs/promises"

const pdf = await getDocument({ data: new Uint8Array(await readFile("contract.pdf")) }).promise
const page = await pdf.getPage(1)
const items = (await page.getTextContent()).items

// transform[5] is the y coordinate, transform[4] the x
const sorted = [...items].sort((a, b) =>
  b.transform[5] - a.transform[5] || a.transform[4] - b.transform[4]
)
console.log(sorted.map((item) => item.str).join(" "))

How to do this offline, on the command line

Text extraction is the best-served PDF job on the command line.

pdftotext

macOS: brew install poppler · Debian/Ubuntu: apt install poppler-utils

pdftotext -layout contract.pdf contract.txt

-layout preserves columns and table alignment; drop it for a single reflowed stream.

mutool

macOS: brew install mupdf-tools · Debian/Ubuntu: apt install mupdf-tools

mutool draw -F text -o contract.txt contract.pdf

MuPDF often orders multi-column pages differently from poppler; try both when one produces scrambled reading order.

Frequently Asked Questions

How do I extract text from a PDF?
Upload your PDF, and the tool reads the embedded text layer and outputs a clean .txt file. Everything runs in your browser — the PDF is never sent to a server.
Does it work on scanned PDFs?
This tool extracts the digital text layer in a PDF. Scanned documents that are images of text contain no text layer, so they need OCR first. Text-based PDFs work instantly.
Is my PDF kept private?
Yes. Text extraction happens entirely on your device using your browser. Your file is never uploaded, stored, or shared.
Are line breaks and reading order preserved?
Yes. The extractor groups text by line position so the output keeps its original line breaks and top-to-bottom reading order.

Need More Tools?

Explore our collection of 58 free PDF tools, all with privacy-first processing.

Browse All Tools