Convert PDF to markdown + JSON quickly with high accuracy
Convert PDF to markdown + JSON quickly with high accuracy
State of the Art models for Document Intelligence
Marker converts documents to markdown, JSON, chunks, and HTML quickly and accurately.
Our managed platform runs a version of our latest open source model, Chandra — higher accuracy than Marker, with zero data retention by default, SOC 2 Type 2, and custom BAAs.
If you have high volume workloads, we offer a batch processing service that has processed 1B+ pages per week — we manage the infrastructure so your workloads finish on time.
Get started with $5 in free credits — sign up.
We measure marker on olmocr-bench, a third-party benchmark of 1,403 PDFs with tests covering math, tables, multi-column layout, scans, and hard edge cases. Balanced mode scores 76.0% overall — 83.5% on born-digital PDFs — ahead of MinerU and docling and within range of much larger VLMs, while fast mode runs the layout + text-layer path far cheaper (and a no-OCR mode goes faster still). Scores are the olmocr-bench overall (macro-average across the 8 categories).
See below for the full per-category scores, the competitive comparison, and instructions on how to run your own benchmarks.
For the highest accuracy, pass the --use_llm flag to use an LLM alongside marker. This will do things like merge tables across pages, handle inline math, format tables properly, and extract values from forms. It works with Gemini, Claude, OpenAI-compatible, Azure, Vertex, OpenRouter, or Ollama models. By default, it uses gemini-3.5-flash. See below for details.
| File type | Markdown | JSON | |
|---|---|---|---|
| Think Python | Textbook | View | View |
| Switch Transformers | arXiv paper | View | View |
| Multi-column CNN | arXiv paper | View | View |
Our code is licensed under Apache 2.0 — free to use, including commercially. Our model weights use a modified AI Pubs Open Rail-M license (free for research, personal use, and startups under $5M funding/revenue). For commercial use of the model weights beyond that, visit our pricing page here.
Discord is where we discuss future development.
You'll need python 3.10+ and PyTorch.
Install with:
pip install marker-pdfIf you want to use marker on documents other than PDFs, you will need to install additional dependencies with:
pip install marker-pdf[full]Surya auto-spawns the server on first use, and you need vllm (NVIDIA GPU) or llama.cpp (CPU / Apple Silicon):
llama-server binary from llama.cpp:brew install llama.cpp # macOS
# or grab a release from https://github.com/ggml-org/llama.cpp/releasesFirst, some configuration:
--mode balanced|fast; defaults by device — balanced on GPU, fast on CPU/MPS):balanced (best on a GPU) uses the surya VLM for layout, OCRs inline math, and re-OCRs the whole page whenever any of its embedded text is bad — highest quality.fast (optimized for CPU) uses the lightweight rf-detr layout detector, extracts text with pdftext, and keeps VLM use minimal: equations, surgical block-level repair of individual garbled/empty blocks, and a single full-page pass only for pages that are scanned or mostly bad. A clean digital document without equations never starts the VLM server.--disable_ocr turns off all VLM calls (including equations) in either mode — pure text-layer extraction.SURYA_INFERENCE_URL=http://host:port/v1.SURYA_INFERENCE_BACKEND (vllm or llamacpp), SURYA_INFERENCE_PARALLEL (concurrent requests — by default this auto-scales to the server's capacity: the GPU's max_num_seqs under vllm, a conservative slot count under llama.cpp; set an int only to override), SURYA_INFERENCE_KEEP_ALIVE (keep the server running between invocations), VLLM_GPUS (GPU indices for the server).--force_ocr to force OCR on all pages, or the strip_existing_ocr to keep all digital text, and strip out any existing OCR text.ocr_inline_math); in fast mode, set --force_ocr or --ocr_inline_math to get the same.I've included a streamlit app that lets you interactively try marker with some basic options. Run it with:
pip install -U streamlit streamlit-ace
marker_guimarker_single /path/to/file.pdfYou can pass in PDFs or images.
Options:
--mode [balanced|fast]: Conversion mode (see above). Defaults by device: balanced on GPU, fast on CPU/MPS.--disable_ocr: Never call the VLM - pure text-layer extraction (equations and scanned pages are skipped).--page_range TEXT: Specify which pages to process. Accepts comma-separated page numbers and ranges. Example: --page_range "0,5-10,20" will process pages 0, 5 through 10, and page 20.--output_format [markdown|json|html|chunks]: Specify the format for the output results.--output_dir PATH: Directory where output files will be saved. Defaults to the value specified in settings.OUTPUT_DIR.--paginate_output: Paginates the output, using \n\n{PAGE_NUMBER} followed by - * 48, then \n\n--use_llm: Uses an LLM to improve accuracy. You will need to configure the LLM backend - see below.--force_ocr: Force OCR processing on the entire document, even for pages that might contain extractable text.--block_correction_prompt: if LLM mode is active, an optional prompt that will be used to correct the output of marker. This is useful for custom formatting or logic that you want to apply to the output.--strip_existing_ocr: Remove all existing OCR text in the document and re-OCR with surya.--redo_inline_math: If you want the absolute highest quality inline math conversion, use this along with --use_llm.--disable_image_extraction: Don't extract images from the PDF. If you also specify --use_llm, then images will be replaced with a description.--keep_pageheader_in_output / --keep_pagefooter_in_output: Keep running page headers / footers in the output instead of stripping them (they are removed by default).--debug: Enable debug mode for additional logging and diagnostic information.--processors TEXT: Override the default processors by providing their full module paths, separated by commas. Example: --processors "module1.processor1,module2.processor2"--config_json PATH: Path to a JSON configuration file containing additional settings.config --help: List all available builders, processors, and converters, and their associated configuration. These values can be used to build a JSON configuration file for additional tweaking of marker defaults.--converter_cls: One of marker.converters.pdf.PdfConverter (default) or marker.converters.table.TableConverter. The PdfConverter will convert the whole PDF, the TableConverter will only extract and convert tables.--llm_service: Which llm service to use if --use_llm is passed. This defaults to marker.services.gemini.GoogleGeminiService.--help: see all of the flags that can be passed into marker. (it supports many more options then are listed above)OCR runs through the surya VLM, which is multilingual - see the surya README for details. If you don't need OCR, marker can work with any language.
marker /path/to/input/foldermarker supports all the same options from marker_single above.--workers is the number of conversion workers to run simultaneously. This is automatically set by default, but you can increase it to increase throughput, at the cost of more CPU usage. All workers share a single inference server, which the parent process spawns.SURYA_INFERENCE_PARALLEL yourself only to override.--disable_ocr no inference server is started at all, and the pool is sized purely by CPU cores.--skip_existing skips input files that already have output in --output_dir (resume a run); --max_files N caps how many files are converted; --disable_multiprocessing runs everything in one process.marker /folder --output_dir out — defaults handle it: one vllm server, a CPU-sized worker pool, concurrency budgeted to the GPU. Add --mode fast if you want cheaper/faster conver[BUG: Breaking] OllamaService sends incomplete JSON Schema to Ollama (missing $defs) causing structured output requests to fail
[BUG: Output] Text from no-ToUnicode CID fonts with lying glyph names bypasses flag_bad_blocks; garbled text and control bytes ship in markdown
README says --disable_multiprocessing runs everything in one process, but it only sets pdftext_workers=1
Your project is on StackMap — a curated map of the AI stack
[BUG: Breaking]ollama, 400 error: Bad Request ,and error: LLM did not return a valid response
[Feature Request / Bug] Issues with mid-sentence image insertion, internal link escaping, and output file extension
Failing in Tables with Empty Cells
out of memory issue for big pdf even decompose that in sending 5 pages for processing
[Feature Request] Chinese document parsing resilience — post-processing fallback, structured validation, per-page error isolation
bucket_headings(): np.sort breaks the height/label pairing, and n_clusters is not clamped to distinct sizes