Skip to main content

docx2everything

Convert DOCX files to plain text or markdown format with preserved structure.

Installation

pip install docx2everything

Or install from source:

# Modern way (recommended)
pip install .

# Or using setup.py (deprecated but still works)
python setup.py install

Testing Without Installation

The CLI script works directly without installation - no PYTHONPATH needed!

Using CLI (no installation required):

# Extract text
python3 bin/docx2everything demo.docx

# Convert to markdown
python3 bin/docx2everything --markdown demo.docx > output.md

# With images
python3 bin/docx2everything --markdown -i images/ demo.docx > output.md

Using Python:

# Set PYTHONPATH to current directory
PYTHONPATH=. python3 -c "import docx2everything; print(docx2everything.process('demo.docx')[:100])"

In Python script:

import sys
sys.path.insert(0, '/path/to/python-docx2txt')

import docx2everything
text = docx2everything.process('document.docx')

Usage

Command Line

Extract plain text:

docx2everything document.docx

Convert to markdown:

docx2everything --markdown document.docx > output.md

Extract images:

docx2everything -i images/ document.docx

Markdown with images:

docx2everything --markdown -i images/ document.docx > output.md

Python API

import docx2everything

# Extract plain text
text = docx2everything.process("document.docx")

# Convert to markdown
markdown = docx2everything.process_to_markdown("document.docx")

# Extract images
text = docx2everything.process("document.docx", img_dir="images/")

# Markdown with images
markdown = docx2everything.process_to_markdown("document.docx", img_dir="images/")

Features

  • ✅ Plain text extraction
  • ✅ Markdown conversion with preserved structure:
    • Tables → Markdown tables (with merged cells support, alignment hints)
    • Lists → Bulleted/numbered lists (with proper sequence tracking)
    • Headings → Markdown headings (#, ##, ###, etc.) with custom style detection
    • Formatting → Bold, italic, strikethrough
    • Links → Markdown links
    • Images → Markdown image references
    • Footnotes → Markdown footnote references [^1]
    • Endnotes → Markdown endnote references [^1]
    • Comments → Inline HTML comments with author info
    • Charts → Chart placeholders with type and metadata *[Chart: Title (Chart Type)]*
    • Page breaks → HTML comments <!-- Page Break -->
    • Section breaks → HTML comments <!-- Section Break -->
  • ✅ Image extraction
  • ✅ Header and footer support
  • ✅ Custom style detection (parses styles.xml for better heading detection)
  • ✅ Table formatting (column alignment detection and hints)
  • ✅ Robust error handling for malformed DOCX files

Requirements

Python 3.6+

License

MIT License - see LICENSE.txt

Metadata

Release files for docx2everything 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for docx2everything 1.1.0
File Size Uploaded Provenance Actions
docx2everything-1.1.0.tar.gz 16.9 kB Without provenance Details for docx2everything-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for docx2everything 1.1.0
File Interpreter ABI Platform Actions
docx2everything-1.1.0-py3-none-any.whl Python 3 none any Details for docx2everything-1.1.0-py3-none-any.whl

Total release size: 38.3 kB

Release files / docx2everything-1.1.0.tar.gz

Download URL docx2everything-1.1.0.tar.gz
Size 16.9 kB
Tags Source
SHA-256 checksum
How to use checksums
4772d8131a970fe6c5c22f24f09669fd05360d4b2e0bb3e975e91b037cb685f8
BLAKE2b-256 checksum
How to use checksums
c7bd46060c9f65eb0b1624b6601d2ecf516eea3f60848b27180f1ea14107f8e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / docx2everything-1.1.0-py3-none-any.whl

Download URL docx2everything-1.1.0-py3-none-any.whl
Size 21.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a0437f0959732f302444a9c5bbb5c2f09e969360a520b11558cdb263e3674122
BLAKE2b-256 checksum
How to use checksums
fbb844881ce72db76cd4c052275ad4e8ebcae47ffea939f35aa7a51d64384786
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Security for docx2everything 1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page