# MinerU

> Turn PDFs, Office files, and scans into clean Markdown or JSON for RAG and LLMs

- Category: Retrieval & Knowledge (RAG) / Parsing & Ingestion
- Language: Python
- Licence: MinerU Open Source License (based on Apache-2.0)
- Repository: https://github.com/opendatalab/MinerU
- Website: https://opendatalab.github.io/MinerU/
- Canonical page: https://ai-tldr.dev/tools/mineru/

## In short

MinerU is Turn PDFs, Office files, and scans into clean Markdown or JSON for RAG and LLMs. It sits in the Parsing & Ingestion category of the Retrieval & Knowledge (RAG) tools and is open-source, written in Python and licensed MinerU Open Source License (based on Apache-2.0). To get started: install MinerU.

## Overview

MinerU is an open-source tool that extracts content from documents and outputs it as clean Markdown or JSON. It handles PDFs, DOCX, PPTX, XLSX files, images, and scanned pages, and reconstructs the page layout so the text comes out in normal human reading order with headers and footers removed.

It is aimed at developers building RAG pipelines, search, and LLM or agent workflows who need reliable text out of messy source files. It deals with complex cases like multi-column layouts, cross-page tables, handwriting, and CJK and other non-Latin scripts, converting formulas to LaTeX and tables to HTML.

Within document parsing and ingestion, MinerU sits at the front of the pipeline: it ships a CLI, an API, and integrations (MCP server, LangChain, Dify, FastGPT and others), and can run offline on CPU or GPU using a pipeline, VLM, or hybrid backend.

## What it does

- Parses PDF, DOCX, PPTX, XLSX, images, and web pages into structured Markdown or JSON
- Converts formulas to LaTeX and tables to HTML, with layout reconstruction
- Handles scanned docs, handwriting, multi-column layouts, and cross-page table merging
- VLM + OCR dual engine with OCR recognition across 109 languages
- Multiple backends: pipeline (CPU/GPU, no hallucination), VLM, and hybrid
- Integrations for MCP (Cursor, Claude Desktop), LangChain, LlamaIndex, Dify, FastGPT, plus CLI and REST API

## Getting started

Install MinerU with uv, then parse a file from the command line.

1. Install MinerU

   Install the package with all extras using uv. You can also install uv via pip first if you do not have it.

```bash
pip install uv
uv pip install -U "mineru[all]"
```

2. Parse a document

   Point the CLI at an input file (or directory) and an output folder. MinerU writes the extracted Markdown and JSON there.

```bash
mineru -p <input_path> -o <output_path>
```

3. Run on a CPU-only machine

   Use the pipeline backend, which runs on CPU or GPU and avoids hallucinated content.

```bash
mineru -p <input_path> -o <output_path> -b pipeline
```

## When to use it

- Build a RAG knowledge base by converting a folder of PDFs and Office files into clean Markdown for chunking and embedding
- Extract tables and formulas from scientific or financial PDFs into HTML and LaTeX for downstream processing
- Digitize scanned or handwritten documents using OCR across many languages, including CJK content
- Feed parsed document text into an LLM or agent workflow via the MCP server or LangChain/Dify integrations
