datalab-to/marker
Convert PDF to markdown + JSON quickly with high accuracy
What it solves
Converting PDFs and other document types into clean, usable text is often messy. Extracting tables, equations, forms, and multi-column layouts manually is tedious and error-prone. Marker solves this by automatically parsing these elements into structured formats like Markdown, JSON, or HTML, while stripping out irrelevant artifacts such as running page headers and footers.
How it works
Marker processes documents in stages. In balanced mode (best on a GPU), it uses a vision-language model called Surya for layout detection, OCR, and inline math conversion. In fast mode (optimized for CPU), it uses a lightweight layout detector and extracts text directly from the PDF's text layer, only calling the VLM for equations or garbled blocks. You can also pass a --use_llm flag to send output through an LLM such as Gemini or Claude, which merges tables across pages, formats them properly, and extracts values from forms for the highest accuracy. The tool offers dedicated converters for whole PDFs, tables only, or OCR only, and output formats include Markdown, HTML, JSON, and page chunks.
Who it's for
Developers and data engineers who need to turn large volumes of documents into structured text for pipelines, AI agents, or search indexes. It is for anyone needing high-quality Markdown or JSON from PDFs, images, or Office files, and who wants a tool that runs locally on GPU, CPU, or Apple Silicon, or through a managed API with an optional free tier.
Highlights
- Converts PDF, image, PPTX, DOCX, XLSX, HTML, and EPUB files in all languages.
- Preserves complex formatting: tables, forms, equations, inline math, links, and code blocks.
- Extracts and saves images, and removes headers, footers, and other artifacts by default.
- Offers balanced (GPU) and fast (CPU) modes, plus a no-OCR mode for pure text-layer extraction.
- Boosts accuracy via an optional LLM pass for tasks like merging tables and extracting form values.
- Includes a Streamlit interactive app, a Python API, and a CLI for batch processing.
- Extensible via custom processors and a JSON configuration system.
- Benchmark scores on olmocr-bench show 76.0% overall in balanced mode (83.5% for born-digital PDFs), ahead of MinerU and docling.
Related
- Project
- Project
- Project
- Project
- Project