Skip to content

Python-Redlines: Open-Source DOCX Comparison for Python

Python-Redlines is an open-source DOCX comparison tool that generates native Word tracked changes (redlines) in Python — without any MS Word dependency. Compare two .docx files and get back a third document showing every insertion, deletion, and (optionally) moved block of text as real Word tracked changes, openable in Microsoft Word, LibreOffice, or Google Docs.

🔗 Try the live demo — upload two .docx files in your browser and download a real tracked-changes redline, no install required.

Why Python-Redlines

  • Open source, MIT licensed — inspect, fork, or contribute to the comparison engines. No per-comparison fees, no API keys, no vendor lock-in.
  • Runs in-process — document bytes never leave your infrastructure, unlike cloud comparison APIs. Works fully offline and in air-gapped environments.
  • No Microsoft Word required — no COM automation, no Office Interop, no Terms of Service risk from server-side Word automation.
  • Native tracked-changes output — the redline .docx opens in Word with real insertions, deletions, and moves, attributable to an author tag.
  • Cross-platform, high-performance diffing engine — the default Docxodus engine is a modernized .NET 10 fork of Open-XML-PowerTools' WmlComparer, shipped as a prebuilt, self-contained binary embedded in the wheel for Linux, macOS, and Windows (x64/arm64) — nothing to compile.

Install

pip install python-redlines[docxodus]

Minimal example

from python_redlines import DocxodusEngine

with open("original.docx", "rb") as f:
    original = f.read()
with open("modified.docx", "rb") as f:
    modified = f.read()

engine = DocxodusEngine()
redline_bytes, stdout, stderr = engine.run_redline("Reviewer", original, modified)

with open("redline.docx", "wb") as f:
    f.write(redline_bytes)

Where to go next