ansi2html
Convert text with ANSI color codes to HTML or to LaTeX
Decision gist · record as of 2026-08-14
Yes. ansi2html is a stable, actively maintained utility with no known vulnerabilities, low install friction, and a clear single purpose. The copyleft LGPLv3+ license is appropriate for open-source projects and most internal use; proprietary projects should verify compatibility. Install it if you need to convert ANSI-colored terminal output to HTML or LaTeX.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Low friction install with minimal dependencies.
- Active maintenance with recent commits as of 2026-08-03 and stable production status.
License · maintenance · safety
LGPLv3+ (copyleft) — Licensed under LGPLv3+, a copyleft license requiring derivative works to remain open-source under the same terms. Suitable for open-source projects; proprietary use requires careful review.
last release 2024-06-22 (783 days) · last repo commit 2026-08-03 · 423 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 2,302,559 downloads/mo, #3,155 on PyPI
Alternatives
Verify before relying
pip install ansi2html
from ansi2html import Ansi2HTMLConverter
conv = Ansi2HTMLConverter()
html = conv.convert(ansi_text)- Whether LaTeX output preserves all ANSI color codes or only a subset
- Performance characteristics with very large ANSI-colored outputs
- Specific ANSI codes or color ranges supported by the converter
What it is and what it does
ansi2html is a utility for converting terminal text containing ANSI color and formatting codes into HTML or LaTeX markup. It works both as a Python library (via the Ansi2HTMLConverter class) and as a command-line tool, making it useful for capturing colored terminal output and rendering it in web pages or documents. The package depends on importlib-metadata and typing-extensions, both lightweight standard-library backports.
Typical use cases include converting colored log output to HTML for web display, converting task runner output to shareable HTML, or piping colored command output through the tool to preserve formatting. It has been actively maintained since its first release in 2010, supports Python 3.7 through 3.12, and carries no known security vulnerabilities.
Use it for
- Convert colored log files to HTML for web-based log viewing and archival
- Pipe colored CLI tool output through ansi2html to create shareable HTML reports
- Preserve terminal colors when exporting test runner or build tool output to HTML
- Convert colored task management or monitoring tool output to LaTeX for documentation
- Generate HTML versions of colored terminal sessions for documentation or tutorials
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
ansi2html is a stable, actively maintained utility with no known vulnerabilities, low install friction, and a clear single purpose. The copyleft LGPLv3+ license is appropriate for open-source projects and most internal use; proprietary projects should verify compatibility. Install it if you need to convert ANSI-colored terminal output to HTML or LaTeX.
Install
ansi2html on PyPI
Before you install
Low friction install with minimal dependencies. Active maintenance with recent commits as of 2026-08-03 and stable production status.
License in practice
Licensed under LGPLv3+, a copyleft license requiring derivative works to remain open-source under the same terms. Suitable for open-source projects; proprietary use requires careful review.
Quickstart
pip install ansi2html
from ansi2html import Ansi2HTMLConverter
conv = Ansi2HTMLConverter()
html = conv.convert(ansi_text)
Verify before relying
- Whether LaTeX output preserves all ANSI color codes or only a subset
- Performance characteristics with very large ANSI-colored outputs
- Specific ANSI codes or color ranges supported by the converter
Package facts
| License | LGPLv3+ copyleft |
| Python support | Supports the current Python release >=3.7 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packagesimportlib-metadatatyping-extensions |
| Maintenance | Actively maintained 783 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,302,559 / month, #3,155 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableEnvironment :: ConsoleIntended Audience :: DevelopersIntended Audience :: System AdministratorsLicense :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)License :: OSI Approved :: MIT LicenseOperating System :: MacOSOperating System :: POSIXProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: Quality AssuranceTopic :: Software Development :: TestingTopic :: System :: Systems AdministrationTopic :: Text ProcessingTopic :: Text Processing :: MarkupTopic :: Text Processing :: Markup :: HTMLTopic :: Utilities |
Evidence: ansi2html-1.9.2-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “ansi color codes to html”
- ansi2htmlConverts terminal output with ANSI color codes to HTML or LaTeX,…
- ansi2txtConverts ANSI escape sequences (color codes, formatting) from text to…
- strip-ansiRemoves ANSI escape sequences (color codes, formatting directives)…
Give your agent the search over MCP, or paste the wish link into any chat.
More Utilities packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Detects and normalizes text encoding from unknown or ambiguous sources, supporting all IANA character sets that Python's core library provides codecs for, with the ability to register custom codecs.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
Pygments is a syntax highlighter that colorizes source code and text in over 500 languages and formats, outputting to HTML, LaTeX, RTF, SVG, images, or ANSI terminal sequences.
Install it if you need to display or transform source code.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
See also ansi2txt · strip-ansi · ansi · ansicolors · crayons · ansimarkup · colored · rst2ansi · termcolor · pylatexenc