# PDF to Text

> Read the selectable text of a PDF, with a markdown heading when the type is larger.

Free PDF to text tool. Pull the text layer from each page, keep a rough markdown heading, and count tokens. Scanned pages without a text layer are left blank. This tool does not OCR. The file stays in the browser.

- Page: https://benchline.fabwaseem.com/t/pdf-to-text
- Runs: in the browser. Input stays on the device.
- Price: free, no account
- Input: One PDF.
- Output: Plain text, markdown, a per-page breakdown, and a token count.
- Keywords: pdf to text, pdf to markdown, extract pdf text
- Updated: 2026-10-18
- Built by: Waseem Anjum (https://fabwaseem.com)

## How to use it

1. **Add a PDF.** Drop one PDF. It stays in this browser.
2. **Read the text.** Each page is listed with its text. Larger lines become markdown headings.
3. **Copy or download.** Copy the markdown or download it as a text file.

## Use it from an AI agent

MCP tool name: `extract_pdf_text`
MCP endpoint: https://benchline.fabwaseem.com/mcp (Streamable HTTP, no key)
HTTP: POST https://benchline.fabwaseem.com/api/v1/tools/pdf-to-text with the input as the JSON body
This call fetches a public URL on the server. Private addresses are refused.

Read the selectable text layer of a PDF. Returns per-page text, markdown-style headings, and an o200k token count. Does not OCR scans. Send base64 or a public URL. Private addresses are refused.

### Input schema

```json
{
  "type": "object",
  "properties": {
    "data": {
      "description": "PDF bytes as base64 or a data URI. Decoded size is capped at 10 MB. Provide data or url.",
      "type": "string"
    },
    "url": {
      "description": "Public URL of a PDF. Private and local addresses are refused. Provide data or url.",
      "type": "string"
    },
    "filename": {
      "type": "string"
    },
    "mimeType": {
      "type": "string"
    }
  },
  "additionalProperties": false
}
```

### Example tools/call

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "extract_pdf_text",
    "arguments": {
      "url": "https://example.com/file"
    }
  }
}
```

Setup for Claude, Cursor, and VS Code: https://benchline.fabwaseem.com/mcp/guide

## Questions

### Does this OCR a scan?

No. It reads the text already stored in the PDF. A photo of a page comes back empty.

### Is the PDF uploaded?

No. The text layer is read in this browser.

### How are headings chosen?

A line that is clearly larger than the body text becomes a markdown heading. The rest stays as paragraphs.

### What is the token count?

It is an o200k_base count of the markdown, the same encoding the token counter uses.

## Related tools

- [PDF to Image](https://benchline.fabwaseem.com/t/pdf-to-image): Render PDF pages to PNG or JPEG, then download one image or a ZIP.
- [Markdown HTML](https://benchline.fabwaseem.com/t/markdown-html): Convert Markdown to HTML, or HTML back to Markdown, with a live preview.
- [Page to Markdown](https://benchline.fabwaseem.com/t/html-to-markdown-url): Fetch a public page and turn the article into Markdown.
- [Rotate PDF](https://benchline.fabwaseem.com/t/pdf-rotate-organize): Reorder, rotate, or drop pages, then download the PDF.
