Is PyMuPDF Free for Commercial Use? The AGPL License Explained
Is PyMuPDF Free for Commercial Use?
Short answer: not for most commercial products, no. PyMuPDF is licensed under GNU AGPL-3.0, and "free" only applies if your own product is also open-source under a compatible copyleft license. If you're shipping a closed-source app, an internal tool at a company, or a SaaS product — including one that only uses PyMuPDF on the backend and never distributes the code — you almost certainly need a paid commercial license from Artifex, the company behind PyMuPDF and its underlying MuPDF engine.
This trips up a lot of developers who reach for pip install pymupdf while building a PDF to Markdown pipeline, only to discover the licensing question after the code is already in production. This guide walks through what AGPL actually requires, what it costs to avoid, and what your options are — including using file2markdown to sidestep the question entirely.
What AGPL-3.0 Actually Requires
The GNU Affero General Public License (AGPL) is a copyleft license, similar to GPL but with one crucial extra clause: it covers network use, not just distribution.
Under standard GPL, if you never ship or distribute your binary, you can arguably avoid triggering the license. AGPL closes that loophole. If users interact with your software over a network — a web app, an API, a SaaS backend — and that software uses an AGPL-licensed component, you're generally required to:
- Make the complete source code of your application available to those users, including any modifications
- License your entire application under AGPL-compatible terms
- Provide this access even though you never "distributed" a binary in the traditional sense
In practice, this means: if your product calls PyMuPDF anywhere in its stack and a user can reach that functionality over the internet, AGPL's source-disclosure obligation applies to your whole application — not just the PyMuPDF wrapper code you wrote.
For a proprietary SaaS product, an internal enterprise tool, or a client-facing API, that's rarely acceptable. Most companies don't want to open-source their entire codebase because one dependency parses PDFs.
When Is PyMuPDF Actually Free to Use?
AGPL is free — genuinely free, no cost — but only if your project meets the license's conditions. PyMuPDF is safe to use without a commercial license when:
- Your project is itself fully open-source under an AGPL-compatible license
- You're doing personal, academic, or research work with no distribution or hosted network access involved
- You're prototyping locally and have no intention of shipping the code to users or customers
The moment any of the following becomes true, you're in commercial-license territory:
- You ship a closed-source desktop or CLI application that includes PyMuPDF
- You run PyMuPDF inside a hosted API or SaaS product that customers access over a network
- You embed it in a commercial product you sell, even as one component among many
- Your company's legal or compliance team wouldn't sign off on open-sourcing the codebase
What Does a PyMuPDF Commercial License Cost?
Artifex doesn't publish flat pricing — commercial PyMuPDF and PyMuPDF Pro licenses are quoted per project after you contact their sales team, and cost scales with deployment size, revenue, and use case. Developers and teams evaluating this route should expect:
- A sales conversation, not a self-serve checkout — pricing isn't public
- Costs that can run from low four figures to significantly more for larger deployments
- Ongoing licensing fees rather than a one-time purchase, in most cases
For an indie developer, a small team, or anyone building an internal tool, that overhead — both the dollar cost and the procurement time — is often disproportionate to what they actually need: clean text out of a PDF.
Is PyMuPDF Safe and Open Source?
Yes, on both counts, with the licensing caveat above. PyMuPDF is actively maintained, built on the mature MuPDF rendering engine, and its source is fully public on GitHub. "Open source" and "free to use in your product" are different questions — AGPL guarantees the former, not the latter, for closed-source or hosted commercial software.
If you're specifically comparing PyMuPDF's technical merits against alternatives like pypdf or pdfplumber, see our pypdf vs PyMuPDF and pdfplumber vs PyMuPDF comparisons — those cover speed, layout-awareness, and extraction quality in depth. This post focuses specifically on the licensing decision.
Your Options If You Don't Want to Pay for a License
If a commercial PyMuPDF license doesn't make sense for your project, you have a few practical paths:
1. Switch to a permissively-licensed library
pypdf is BSD-3-Clause — fully permissive, safe for closed-source and commercial use with no strings attached. It's pure Python, so it's slower than PyMuPDF's compiled C extraction, and it has weaker layout-awareness. For simple text extraction at moderate volume, it's often good enough. pdfplumber (also permissive) is a solid middle ground for table-heavy PDFs. See the comparisons linked above for a full breakdown.
2. Open-source your project
If your product can genuinely live as AGPL-licensed open source, this removes the licensing question — but it's a business decision, not just a technical one, and most commercial products can't take this path.
3. Use a hosted conversion API instead of a library
This is often the simplest fix: skip the library-licensing question entirely by offloading PDF-to-Markdown conversion to a hosted service. file2markdown converts PDFs (and DOCX, XLSX, PPTX, CSV, JSON, HTML, EPUB, XML, and images) to clean Markdown via a free web tool and API, with no AGPL obligations on your codebase — you're calling an API, not embedding a copyleft-licensed library in your product. This is a common pattern for teams building RAG pipelines or feeding documents to LLMs who'd rather not have a licensing review block a shipping deadline.
4. Buy the commercial license
If PyMuPDF's speed and layout-awareness are load-bearing for your product and the AGPL terms don't work, budget for the commercial license and start that sales conversation early — procurement can take longer than the engineering work.
How to Convert PDFs to Markdown Without the Licensing Question
If you're building a document pipeline — for RAG, LLM context injection, note-taking, or internal search — and just need reliable Markdown output, file2markdown handles the conversion for you:
- Upload a PDF (or DOCX, XLSX, PPTX, CSV, JSON, HTML, EPUB, or XML file) via the web tool or the API
- Get back clean, structured Markdown — headings, tables, and lists preserved
- Drop the output straight into your RAG pipeline, Obsidian vault, or LLM context window
No library to vet for licensing, no AGPL obligations, no commercial-license sales call. For teams that just need the output and don't want PDF parsing to become a legal review item, that trade-off is usually worth it.
Frequently Asked Questions
Does AGPL apply if I only use PyMuPDF on my backend and never expose the code?
Yes. This is the specific gap AGPL was written to close. Unlike GPL, AGPL triggers on network use — if users interact with your application over a network (a web app, an API), the source-disclosure requirement applies even though you never distribute a binary or share your repository directly.
Can I use PyMuPDF for free in a personal project?
Yes, as long as you're not distributing it or offering it as a hosted service to others under closed terms. Personal experimentation, academic research, and fully open-source AGPL-compatible projects are all fine under the free license.
What's the difference between PyMuPDF and PyMuPDF4LLM licensing?
PyMuPDF4LLM, the LLM/RAG-oriented extension built on top of PyMuPDF, follows the same AGPL-3.0 licensing as the base library. The commercial license path (via PyMuPDF Pro) is the same conversation with Artifex. See our PyMuPDF4LLM vs Docling comparison for how it stacks up on extraction quality.
Is there a free, fully permissive alternative to PyMuPDF?
For a library you embed directly, pypdf (BSD-3-Clause) is the most permissive well-maintained option, though slower and less layout-aware. If you'd rather not manage a parsing library at all, a hosted tool like file2markdown removes the licensing question entirely since you're calling an API rather than bundling AGPL code into your product.
The Markdown Memo
A fortnightly note for lawyers, researchers, accountants, and anyone else drowning in PDFs, scans, and decks. No spam.