MA

Marker

Convert PDFs and documents to Markdown with AI

Self-Hosted AI ★ 39.9k stars Medium setup GPL-3.0

Marker quickly and accurately converts PDFs, images, and office documents into Markdown, JSON, or HTML. It uses deep learning models to handle tables, equations, and complex layouts.

Key features

  • Accurate PDF to Markdown
  • Handles tables and equations
  • Many output formats
  • Optional LLM enhancement

Pros & cons

Strengths

  • High-accuracy PDF conversion
  • Handles tables and equations
  • Multiple output formats

Trade-offs

  • GPU recommended for speed
  • Commercial licensing limits

Marker replaces

Last reviewed Aug 26, 2026 · 879 words

Marker's code is GPL-3.0 and its model weights are not, and if you skip that sentence you can ship a product on it that you are not licensed to ship. The weights doing the layout detection and OCR (from Surya, the sister project by the same team at Datalab) carry their own terms: free for research, personal use, and organisations under a revenue and funding threshold that was $2 million at last check, with a paid licence from Datalab above that. For a homelab converting manuals and papers into a notes system, irrelevant. For a startup building a document pipeline, the first thing to read. With that settled: this is the most accurate PDF-to-Markdown converter you can run offline, 39,232 GitHub stars, Python, a 4 GB RAM floor, and a GPU that turns hours into minutes.

Tables and equations are the reason to pick it

Every extractor handles a one-column text PDF. Marker earns its keep on the documents that break the others: a two-column paper with an equation block, a financial report with merged table cells, a scan with a rotated page. It runs a layout model to find blocks, an ordering model to sequence them, OCR only where a page has no usable text layer, and dedicated handling for tables (emitted as Markdown tables) and math (emitted as LaTeX between $$). Headings come out as real # levels rather than bold lines, which matters more than it sounds for anything downstream that chunks by heading. Figures are extracted to image files and referenced from the Markdown, so the output folder is a self-contained document rather than a text dump.

The CLI is two commands and a folder

pip install marker-pdf          # add [full] for DOCX, PPTX, XLSX, EPUB, HTML input
marker_single paper.pdf --output_dir out --output_format markdown
marker /srv/pdfs --output_dir out --workers 4

--output_format also takes json (a block tree with bounding boxes, useful if you want to write your own chunker) and html. --page_range 0-9 limits a run, --force_ocr overrides a garbage text layer, and --workers parallelises across a folder. First run pulls the model weights from Hugging Face into your cache, a download measured in gigabytes, after which the machine can be offline. There is also marker_server, a small FastAPI wrapper, if you want to POST files from another service; it is fine on a LAN, but it has no auth of its own, so keep it behind your reverse proxy or off the internet.

GPU is where speed lives; CPU is where a batch job lives

On CPU, expect single-digit seconds per page for clean text and much longer for scanned pages that need OCR, which is fine for converting a folder overnight and unusable behind a web form. Any NVIDIA card with 6 GB of VRAM or more makes it interactive; set TORCH_DEVICE=cuda (or mps on Apple silicon) if autodetection picks wrong. The 4 GB RAM floor holds for single documents; a 300-page book with --workers 4 wants 8 GB or more, because each worker loads its own copy of the models. If you have no GPU and want a document server rather than a batch tool, that changes the choice, see the table below.

--use_llm improves tables and stays local with Ollama

Marker's optional LLM pass re-reads difficult blocks (complex tables, forms, inline math) with a language model and fixes what the vision models got wrong. The default service is Gemini, which means sending page images to Google. It does not have to:

marker_single report.pdf --use_llm \
  --llm_service marker.services.ollama.OllamaService \
  --ollama_base_url http://localhost:11434 --ollama_model qwen2.5vl:7b

Pointing it at Ollama with a vision-capable model keeps every byte on your hardware. The cost is speed, roughly doubling or tripling a run, and the gain is real only on documents with hard tables. Leave it off by default and switch it on for the files that come out wrong.

Marker or Docling: pick by what you are feeding it

The two are the serious local options and they overlap heavily. Where they split:

Your casePick
Papers, textbooks, anything with mathMarker
Enterprise DOCX and PPTX, plus a RAG framework integrationDocling
Commercial product, no appetite for a weights licenceDocling (MIT)
Scans you want searchable, not restructuredOCRmyPDF
Occasional conversions through a web UIStirling PDF

Marker's Markdown is, in my experience, cleaner on academic material and its equation output is better. Docling's licence is simpler and it ships as a tidier library. Neither replaces a document manager like Paperless-ngx, which stores and searches; these two convert.

What I'd do

Read the weights licence once, decide which side of the threshold you are on, and if you are under it, pip install marker-pdf[full] into a venv on the machine with the GPU. Convert with plain marker over a folder: JSON output if you are building a RAG index, Markdown if a human will read it, --use_llm through Ollama only for the files that come out wrong. If the licence is a problem or your documents are mostly Office files, that is the day you install Docling instead.

Compare Marker

1 head-to-head comparisons.

Similar self-hosted ai apps