rtfparse
Tool to parse Microsoft Rich Text Format (RTF)
What it is and what it does
rtfparse is a Python library that reads Microsoft RTF documents and builds an in-memory object tree representing their structure. It then passes that tree to a renderer—currently only HTML_Decapsulator is provided, which extracts HTML that has been embedded within RTF (a common pattern in Outlook email messages). The library also handles RTF decompression, which Outlook uses to reduce file size.
You can use it as a command-line tool or import it into your own Python code. The CLI writes logs to ~/rtfparse/ and supports workflows like extracting HTML from .msg files, decompressing RTF, and saving attachments. The library depends on extract-msg to read Outlook message files and compressed-rtf to decompress them when needed.
Use it for:
- Extract HTML content from RTF-formatted email messages saved by Microsoft Outlook.
- Decompress RTF files that have been compressed by Outlook or other Microsoft applications.
- Parse RTF documents programmatically and render them to HTML for web display or archival.
- Batch-process .msg files to recover embedded HTML and attachments from email archives.
- Build custom renderers for RTF documents by extending the parser's tree structure.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Parses Microsoft Rich Text Format (RTF) documents into an in-memory tree structure and renders them—primarily extracting encapsulated HTML, with optional RTF decompression support for Outlook messages.
Yes, if you need to extract HTML from Outlook emails or parse RTF documents. The library is stable (Production/Stable classifier), has no known vulnerabilities, and low install friction. However, maintenance is aging—the last release was over a year ago—so consider whether you need active support or can tolerate a stable but slowly-evolving codebase.
Install
rtfparse on PyPI
pip
pip install rtfparseuv
uv add rtfparsepoetry
poetry add rtfparseInstalling rtfparse
Before you install
Low friction: pure Python wheel with four runtime dependencies (argcomplete, compressed-rtf, extract-msg, provide-dir). Maintenance status is aging—last release was 402 days ago, though the repository remains active with a recent commit on 2025-09-10.
License in practice
MIT license permits commercial and private use with minimal restrictions; you must include a copy of the license and copyright notice in distributions.
Quickstart
pip install rtfparse
from rtfparse.parser import Rtf_Parser
from rtfparse.renderers.html_decapsulator import HTML_Decapsulator
parser = Rtf_Parser(rtf_path="document.rtf")
parsed = parser.parse_file()
renderer = HTML_Decapsulator()
with open("output.html", "w") as f:
renderer.render(parsed, f)
Requires Python 3.10 or later.
Verify before relying
- Whether the HTML_Decapsulator renderer handles all RTF variants and edge cases reliably in production.
- Performance characteristics when parsing large or complex RTF documents.
- Whether custom renderers beyond HTML_Decapsulator are documented or supported.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — argcomplete, compressed-rtf, extract-msg, provide-dir |
| Maintenance | aging — 402 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 307,054/month — #7,781 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: rtfparse-0.9.5-py3-none-any.whl
Keywords: parse, rtf
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
compressed-rtfCompresses and decompresses Rich Text Format…
permissive · top 5,000 on PyPI
RTFDEExtracts encapsulated HTML and plain text…
copyleft · top 5,000 on PyPI
PyRTF3PyRTF3 generates Rich Text Format (RTF)…
copyleft · top 15,000 on PyPI
extract-msgExtracts email metadata (from, to, cc, date,…
copyleft · top 5,000 on PyPI
striprtfConverts Rich Text Format (RTF) files to plain…
permissive · top 5,000 on PyPI
msg-parserParses Microsoft Outlook MSG email files,…
permissive · top 15,000 on PyPI
rich-text-rendererConverts Contentful RichText field data into…
permissive · top 15,000 on PyPI
tnefparseDecodes Microsoft's Transport Neutral…
copyleft · top 15,000 on PyPI
python-oxmsgParses Outlook MSG files to extract email…
permissive · top 5,000 on PyPI
rich-rstRenders reStructuredText documents as Rich…
permissive · top 1,000 on PyPI