Guide · Marker

Marker PDF to Markdown: install and convert a PDF

Marker is an open-source document parser that turns PDFs, scans and office files into Markdown, HTML or JSON. This guide covers the current install, the CPU-friendly command and the parts that still need a human review.

Updated November 23, 2026 · Markdown2PDF by Hyperdyn

What Marker is good at

Marker is built for documents that need structure, not just plain text. It detects page layout and reading order, reconstructs tables, keeps code blocks and converts equations to LaTeX. It can also extract images and strip running headers and footers.

That makes it a better fit than a basic text extractor for academic papers, technical reports, manuals and multi-column documents. It is still an inference pipeline: no tool can guarantee a perfect Markdown reconstruction from a visual PDF.

Direction check: Marker converts PDF to Markdown. Markdown2PDF does the opposite — it renders Markdown into a styled, print-ready PDF in your browser. It does not run Marker or convert PDFs back to Markdown.

Install Marker

Marker is a Python package. Use Python 3.10 or newer and install it into a virtual environment so its model and PyTorch dependencies do not affect other projects.

python -m venv .venv
# Windows: .venv\Scripts\activate
# macOS / Linux: source .venv/bin/activate
python -m pip install --upgrade pip
pip install marker-pdf

The CPU-friendly fast mode runs the layout and OCR models in-process, so you do not need a separate GPU server. The higher-accuracy balanced and vllm modes use a Surya inference server and are aimed at NVIDIA GPUs or a local llama.cpp setup. Check Marker's current README for the hardware requirements of the version you install.

Convert a PDF from the command line

For a single file, use marker_single. The example below forces the CPU mode, writes Markdown and puts the result in an output directory:

marker_single input.pdf \
  --output_dir output \
  --output_format markdown \
  --mode fast

Marker writes a .md file named after the input, plus any extracted images. You can print Markdown directly to a pipe with --stdout, limit pages with --page_range "0,5-10", or disable image extraction with --disable_image_extraction.

For a folder of PDFs, use the batch command:

marker ./pdfs --output_dir output --mode fast

Use Marker from Python

The Python API is useful when you need to attach Marker to an ingestion job or save the rendered output yourself:

from marker.converters.pdf import PdfConverter
from marker.models import create_model_dict
from marker.output import text_from_rendered

converter = PdfConverter(artifact_dict=create_model_dict())
rendered = converter("input.pdf")
markdown, _, images = text_from_rendered(rendered)

with open("output.md", "w", encoding="utf-8") as handle:
    handle.write(markdown)

Model loading is the expensive part. Reuse the converter for multiple documents in a long-running worker instead of creating a new model dictionary for every file.

Review the Markdown before you trust it

  1. Open the Markdown in a preview and compare it with the original page order.
  2. Check tables cell by cell; merged cells and rotated tables are common failures.
  3. Inspect equations, footnotes and code fences rather than assuming they survived.
  4. Look for repeated headers, page numbers or hyphenated words that need cleanup.
  5. Keep the PDF and the Markdown together if the document is a source of record.

When Marker is not the right tool

Marker is heavy compared with a text-only extractor. If you only need searchable text, PyMuPDF or pdfplumber may be enough. If you want a broader document-conversion toolkit, Docling is another strong option. MarkItDown is convenient when the output is destined for an LLM rather than a human-readable document.

Compare them on your own sample before committing to a pipeline. The PDF to Markdown comparison covers the trade-offs, and the Python extraction guide shows the lighter-weight code path.

Frequently asked questions

Can Marker run without a GPU?

Yes. Marker has CPU-capable modes, including fast and no_ocr. CPU conversion is slower for large batches and the accuracy profile differs from the GPU modes, so test on your own documents.

Does Marker preserve tables and equations?

It attempts to reconstruct tables and convert equations to LaTeX, and it can extract images. Complex tables, handwriting and unusual layouts may still need manual correction.

Is Marker a hosted PDF to Markdown service?

Marker is an open-source package that you run yourself. The project also offers a managed service, but the CLI and Python API described here run locally.