Convert PDFs into clean, AI-ready Markdown — powered by Claude.
Stop feeding raw PDFs to your AI. Pre-convert them into token-efficient Markdown and cut context overhead by up to 80%.
pdf2ai takes any PDF file and converts it to clean Markdown (or plain text) using Claude's native PDF understanding. Unlike parser-based tools, Claude handles:
- Multi-column layouts
- Scanned PDFs (OCR built-in)
- Tables preserved as Markdown tables
- Footnotes, headers, footers stripped in AI-Optimized mode
- Arabic and multilingual content
Every time you drop a raw PDF into an AI workflow, you're paying a hidden tax:
- PDF requires a skill/tool invocation to read
- Binary structure costs extra tokens to process
- Garbled text from bad parsers degrades output quality
pdf2ai eliminates that tax. Convert once, reuse the clean Markdown everywhere.
- Three output modes: Standard Markdown | AI-Optimized | Plain Text
- Token compression display: See exactly how much context you're saving
- Download + Copy: One-click
.mdfile download or clipboard copy - BYOK: Bring your own Anthropic API key — no account, no signup
- Zero retention: Files never leave your browser. API calls go directly to Anthropic.
- Streaming output: Watch the conversion happen in real time
| Layer | Technology |
|---|---|
| Framework | React 18 + Vite |
| Styling | Tailwind CSS |
| Components | shadcn/ui |
| Language | TypeScript |
| AI | Anthropic, OpenAI, Gemini, Mistral SDKs |
| State | Zustand |
| Validation | Zod |
| Deployment | Cloudflare Pages |
- Node.js 18+
- An Anthropic API key (get one here)
# Clone the repo
git clone https://github.com/mahmoud-bebars/pdf2ai
cd pdf2ai
# Install dependencies
npm install
# Start dev server
npm run devOpen http://localhost:5173
npm run buildOutput is in dist/. Deploy to Cloudflare Pages by connecting the GitHub repo
or dragging the dist/ folder into the Cloudflare dashboard.
- Enter your Anthropic API key (stored locally in your browser only)
- Drop a PDF file into the upload area
- Select your output mode:
- Standard Markdown — full structural conversion, keeps all content
- AI-Optimized — strips page numbers, headers, footers; recommended for RAG/prompts
- Plain Text — no Markdown syntax, maximum token compression
- Click Convert PDF
- Watch the output stream in
- Download the
.mdfile or copy to clipboard - See your token savings in the stats panel
Best for: documentation, reading, archiving
Converts all PDF structure to proper Markdown: headings, lists, tables, code blocks. Preserves the full document including page metadata.
Best for: RAG pipelines, LLM prompt context, agent knowledge bases
Strips decorative noise: page numbers, repeated headers/footers, section dividers. Merges content split across page breaks. Clean heading hierarchy. Typically achieves 60-80% token reduction vs raw PDF.
Best for: simple Q&A, summarization tasks, maximum compression
No Markdown syntax at all. Just the text content with logical paragraph breaks. Maximum token efficiency. Loses table structure.
| Scenario | Raw PDF | After pdf2ai |
|---|---|---|
| 10-page report | ~15,000 tokens | ~3,500 tokens |
| 50-page technical doc | ~75,000 tokens | ~18,000 tokens |
| Scanned form (unreadable) | ~5,000 tokens (garbage) | ~800 tokens (clean) |
Estimates vary by PDF content density and output mode.
- Your PDF is read locally in your browser using the FileReader API
- It is sent as base64 to the Anthropic API using your own API key
- Nothing is stored on any server — not by this app
- Your API key is stored only in
localStoragein your own browser - You can clear it at any time using the clear button in the key input
- Maximum file size: 20MB
- Single file at a time (batch in v1.1)
- Best results on text-based PDFs; scanned PDFs depend on Claude's OCR quality
- Very large documents (100+ pages) may hit API token limits
- Chunk view: split output by page/section for RAG ingestion
- Batch processing: convert multiple PDFs in a queue
- Export as plain
.txtalongside.md
- Arabic/RTL PDF special handling
- Custom prompt mode: write your own extraction instructions
- Shareable conversion configs
Mahmoud Bebars — mahmoudbebars.dev
Bob (Mahmoud Bebars) — backend-focused full-stack developer, Alexandria, Egypt. Building tools for AI builders.
MIT