skillfed

ansi2txt

ansi to plain text converter

ansi2txt v0.2.0 364.0K downloads/30d#7,212 on PyPI
License unclear Abandoned released

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 ansi2txt

uv

uv add ansi2txt

poetry

poetry add ansi2txt

Installing 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

Development Status :: 5 - Production/StableEnvironment :: ConsoleLicense :: OSI Approved :: GNU Affero General Public License v3License :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: TerminalsTopic :: Text ProcessingTopic :: Text Processing :: FiltersTopic :: Utilities

Tags

strip ansi codesremove color codes textansi escape sequence removalplain text from colored outputterminal color strippingansi to plain text
ansi-escape-sequencestext-processing

More Utilities packages