Docling OCRIndependent Docling guide

Reference · command line

Docling CLI: The Commands and Flags That Actually Matter

The Docling command line is small enough to learn in ten minutes and large enough that half the flags are irrelevant to your job. Here is the working subset, plus the ones that change output quality.

Updated 2026-10-26 · 3 min read

The short version

  • –Current releases use subcommands: docling convert, docling convert-remote, docling options.
  • –Output format is selected with --to: md (default), json, html, text, doctags, chunks, latex, dclx and more.
  • –--table-mode fast is the single biggest speed lever on table-heavy documents, at a real accuracy cost.
  • –--ocr-option KEY=VALUE is how you reach engine-specific settings without touching Python.
  • –Run docling convert --help after every upgrade — the flag surface does change between releases.

The command surface

Two binaries ship with the package: docling for conversion, and docling-tools for model management. Most people only ever need the first.

Top-level structure
docling [OPTIONS] COMMAND [ARGS]...

  docling convert [OPTIONS] source        # local file, folder or URL
  docling convert-remote [OPTIONS]       # convert via a docling-serve endpoint
  docling options STAGE [ENGINE]         # inspect ocr | layout | table-structure settings

docling-tools [OPTIONS] COMMAND [ARGS]...
  docling-tools models download
  docling-tools models download-hf-repo

Older versions accepted docling file.pdf --to md without the convert subcommand. If a tutorial does not match your install, check docling --help before assuming the tutorial is wrong — the CLI moved to subcommands.

docling convert: the flags worth memorising

FlagValuesWhy you care
--tomd json yaml html html_split_page text doctags vtt doclang dclx chunks latexOutput format. Defaults to Markdown. Repeatable.
--frompdf docx pptx xlsx html md csv epub … (odf for odt/ods/odp)Restrict accepted input formats. Defaults to all.
--ocr-engineauto easyocr kserve_v2_ocr nemotron-ocr ocrmac rapidocr tesserocr tesseractPick the recognizer instead of trusting auto.
--ocr-langnative codes (deu, ch) or iso: tags (iso:de, iso:zh-Hant)Language packs. Empty string lets each engine use its own default.
--ocr-optionKEY=VALUE, repeatableEngine-specific settings, e.g. model_size=tiny.
--no-ocr—Turn OCR off. Digital PDFs only.
--table-modefast | accurate (default)TableFormer speed/quality trade-off.
--pipelinelegacy standard native vlm asrWhich pipeline to run. standard is the default.
--deviceauto cpu cuda mps xpuForce a device when auto picks the wrong one.
--num-threadsinteger, default 4Inference threads. More is not always faster.
--outputdirectory, default .Where results are written.
--output-filepathExact output path; requires one input and one format.
Verify against `docling convert --help` for your installed version.

Recipes

Quality and hardware levers
# fast tables: much quicker, measurably less precise on merged cells
docling convert statement.pdf --to md --table-mode fast

# CPU only, six threads
docling convert scan.pdf --to md --device cpu --num-threads 6

# Apple Silicon
docling convert scan.pdf --to md --device mps

# scanned PDF that keeps coming out empty
docling convert scan.pdf --to md --force-ocr --ocr-engine rapidocr --ocr-lang en

# VLM pipeline
docling convert paper.pdf --to md --pipeline vlm --vlm-model granite_docling

docling options: what is my pipeline actually doing?

The options subcommand prints the settings for a stage — OCR, layout or table structure — optionally filtered to one engine. It is the fastest way to answer "what defaults am I running with?" and to confirm that an engine you installed is really selectable:

Inspecting stages
docling options ocr
docling options ocr rapidocr
docling options table-structure
docling options layout

docling-tools: model management

docling-tools models download pre-fetches model artifacts so a container start or an air-gapped run does not depend on a live network. Pair it with an artifacts path so runtime looks in the right place.

Which models you need follows from the pipeline: standard conversion needs the layout and table-structure models plus whatever OCR engine you chose; --pipeline vlm needs the VLM of your choice instead. Downloading everything is a reasonable choice for a CI image and a waste for a laptop.

Reading the exit and the output

The CLI writes files rather than streaming content, so a successful run is quiet. Two habits prevent most confusion:

  • Always set --output when scripting. Default output lands in the working directory and it is easy to read a stale file from the previous run.
  • Check the output size first. A 200-page scan producing a 3 KB Markdown file means the pipeline found almost nothing — usually OCR off or no engine installed, not a corrupt PDF.
  • If you need per-table data rather than one Markdown blob, use --to json and read the table structures, or go through Python as in the Docling to Excel guide.

Frequently asked questions

What is the basic Docling command?+

docling convert <source> for Markdown. Add --to json for structure, --to chunks for retrieval, and --output to control where files land.

How do I make Docling faster?+

Try --table-mode fast first, then --num-threads matching your physical cores, then --device to force the GPU. The accurate table model dominates runtime on table-heavy documents.

How do I get JSON instead of Markdown?+

Add --to json (you can repeat --to to emit several formats in one run). The JSON is the DoclingDocument structure, including tables and their cells.

Does the docling command work on URLs?+

Yes — pass the URL as the source and Docling fetches it. For remote conversion through a docling-serve instance, use docling convert-remote instead.

Why did my flags get ignored?+

Usually a version mismatch: the CLI moved to subcommands and some flags were renamed between releases. Run docling convert --help and compare against the tutorial you are following.

Try it online

Run the same pipeline in the browser — no install, no uploads stored.

Try it in the browser

Keep reading