ansi2txt
ansi to plain text converter
What it is and what it does
ansi2txt is a Python port of the original C-based ansi2txt utility that strips ANSI escape sequences from text. It takes input containing terminal color codes and formatting directives and outputs the same text with all styling removed, leaving only the plain content. This is useful when you need to process or store output from colored terminal applications without the escape sequences.
The package has no external runtime dependencies and installs as a pure Python wheel. It was ported from a C codebase specifically to avoid compilation and binary distribution overhead. However, the project is no longer maintained—the last release was in February 2023 with no updates since.
Use it for:
- Strip color codes from log files before archiving or searching them
- Clean up terminal output captured from colored CLI tools for plain-text processing
- Convert colored build or test output to plain text for storage in databases or logs
- Prepare colored command output for regex matching or text analysis
- Remove ANSI sequences from captured terminal sessions for readability
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Converts ANSI escape sequences (color codes, formatting) from text to plain text output, removing all terminal styling.
Yes, if you need straightforward ANSI-to-plain-text conversion and can tolerate an unmaintained package. The zero-dependency design and Production/Stable status make it low-risk for simple use cases. However, verify the dual-license terms apply to your project, and consider whether you need active maintenance or bug fixes for your use case.
Install
ansi2txt on PyPI
pip
pip install ansi2txtuv
uv add ansi2txtpoetry
poetry add ansi2txtInstalling ansi2txt
Before you install
Low install friction with no runtime dependencies. Package is marked abandoned with no activity since its latest release, though it was declared Production/Stable.
License in practice
Dual-licensed under AGPLv3 and MIT, but license_treatment is marked unclear in the metadata. Verify which license applies to your use case before integrating.
Quickstart
pip install ansi2txt
import ansi2txt
# Convert ANSI-coded string to plain text
plain = ansi2txt.convert(colored_string)
Requires Python >=3.7,<4.0 per package metadata
Verify before relying
- Whether the dual AGPLv3/MIT licensing is truly dual-choice or requires compliance with both
- Whether the package handles all ANSI escape sequence types or only a subset
- Current compatibility with Python versions beyond 3.11 despite requires_python allowing up to 4.0
Package facts
| License | not declared (unclear) |
| Python support | supports the current Python release (>=3.7,<4.0) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | abandoned — 1,268 days since the last release |
| First released | |
| Downloads | 363,989/month — #7,212 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: ansi2txt-0.2.0-py3-none-any.whl
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
ansi2htmlConverts terminal output with ANSI color codes…
copyleft · top 5,000 on PyPI
strip-ansiRemoves ANSI escape sequences (color codes,…
unclear · top 15,000 on PyPI
strip-hintsStrips type hints from Python source code while…
unclear · top 5,000 on PyPI
ansiProvides ANSI escape codes for cursor movement…
permissive · top 15,000 on PyPI
coloramaColorama makes ANSI escape sequences for…
permissive · top 100 on PyPI
coloredColored provides ANSI/VT100 escape sequences…
permissive · top 5,000 on PyPI
styleApplies ANSI color and text styling to terminal…
permissive · top 15,000 on PyPI
climageConverts images to ANSI escape code sequences…
permissive · top 15,000 on PyPI
pansiPansi provides a clean interface for rendering…
permissive · top 15,000 on PyPI
jaraco.textProvides utility functions for common text…
permissive · top 5,000 on PyPI