---
title: "ansi2html | pypx"
description: "Convert text with ANSI color codes to HTML or to LaTeX"
canonical_url: "https://pypx.app/packages/ansi2html"
meta:
  "og:description": "Convert text with ANSI color codes to HTML or to LaTeX"
  "og:image": "https://pypx.app/_og/d/h_630%2Cc_PackageCard%2Cname_ansi2html%2Cversion_1.9.5%2Csummary_Convert%2Btext%2Bwith%2BANSI%2Bcolor%2Bcodes%2Bto%2BHTML%2Bor%2Bto%2BLaTeX%2Clicense_~R05VIExlc3NlciBHZW5lcmFsIFB1YmxpYyBMaWNlbnNlIHYzIG9yIGxhdGVyIChMR1BMdjMrKQ%2Cp_Ii9wYWNrYWdlcy9hbnNpMmh0bWwi%2Cs_gDgw3SAUZprv_rMR.png"
  "og:image:height": "630"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "ansi2html 1.9.5"
  "twitter:image": "https://pypx.app/_og/d/h_630%2Cc_PackageCard%2Cname_ansi2html%2Cversion_1.9.5%2Csummary_Convert%2Btext%2Bwith%2BANSI%2Bcolor%2Bcodes%2Bto%2BHTML%2Bor%2Bto%2BLaTeX%2Clicense_~R05VIExlc3NlciBHZW5lcmFsIFB1YmxpYyBMaWNlbnNlIHYzIG9yIGxhdGVyIChMR1BMdjMrKQ%2Cp_Ii9wYWNrYWdlcy9hbnNpMmh0bWwi%2Cs_gDgw3SAUZprv_rMR.png"
---

> Index of every page on this site: [llms.txt](https://pypx.app/llms.txt)

# **ansi2html**

v1.9.5

Convert text with ANSI color codes to HTML or to LaTeX

17 KB Python 3.10+ py3-none-anyGNU Lesser General Public License v3 or later (LGPLv3+)

[** Diff **](https://pypx.app/packages/ansi2html/diff)

`$ uv add ansi2html`

[![tox](https://github.com/pycontribs/ansi2html/actions/workflows/tox.yml/badge.svg?branch=main)](https://github.com/pycontribs/ansi2html/actions/workflows/tox.yml)

# ansi2html

Convert text with ANSI color codes to HTML or to LaTeX.

Inspired by and developed off of the work of [pixelbeat](https://www.pixelbeat.org/docs/terminal_colours/) and [blackjack](https://web.archive.org/web/20100911103911/http://www.koders.com/python/fid5D57DD37184B558819D0EE22FCFD67F53078B2A3.aspx).

[Read the docs](https://ansi2html.readthedocs.io/) for more informations.

## Example - Python API

```
from ansi2html import Ansi2HTMLConverter
conv = Ansi2HTMLConverter()
ansi = "".join(sys.stdin.readlines())
html = conv.convert(ansi)
```

## Example - Shell Usage

```
$ ls --color=always | ansi2html > directories.html
$ sudo tail /var/log/messages | ccze -A | ansi2html > logs.html
$ task rc._forcecolor:yes limit:0 burndown | ansi2html > burndown.html
```

See the list of full options with:

```
$ ansi2html --help
```

## Get this project:

```
$ pip3 install ansi2html
```

Source: https://github.com/pycontribs/ansi2html/

pypi: https://pypi.org/project/ansi2html/

## License

`ansi2html` is licensed LGPLv3+.

# Credits

- Author: [Ralph Bean](mailto:rbean@redhat.com)
- Contributor: [Robin Schneider](mailto:ypid23@aol.de)
- Contributor: [Sebastian Pipping](mailto:sebastian@pipping.org)
- Contributor: [Jens Timmerman](mailto:jens.timmerman@gmail.com)
- Contributor: [Sorin Sbarnea](mailto:ssbarnea@redhat.com)
- Contributor: [Daniel Ziegenberg](mailto:daniel@ziegenberg.at)
- Contributor: [Kuno Woudt](mailto:kuno@frob.nl)
- Contributor: [Robin Schneider](mailto:ypid23@aol.de)
- Contributor: [Martin Zimmermann](mailto:info@posativ.org)
- Contributor: [Paul Sherratt](mailto:paul.sherratt@gamma.co.uk)
- Contributor: [Arusekk](mailto:floss@arusekk.pl)

## **Details **

<dl>

<dt>Version</dt>
<dd>1.9.5</dd>

<dt>License</dt>
<dd>GNU Lesser General Public License v3 or later (LGPLv3+)</dd>

<dt>Python</dt>
<dd>&gt;=3.10</dd>

<dt>Maintainer</dt>
<dd>Ralph Bean &lt;rbean@redhat.com&gt;</dd></dl>

## **Links**

- [changelog](https://github.com/pycontribs/ansi2html/releases)
- [documentation](https://ansi2html.readthedocs.io/)
- [homepage](https://github.com/pycontribs/ansi2html)
- [repository](https://github.com/pycontribs/ansi2html)
- [View on PyPI](https://pypi.org/project/ansi2html/)

## **Release Cadence **

**3**

releases in the past year

avg 104 days between releases

## **Maintainers **

- Ralph Bean · [rbean@redhat.com](mailto:rbean@redhat.com)

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://pypx.app/#website","@type":"WebSite","description":"The Python Package Index, reimagined. Fast search, dependency insights, download trends, and changelogs — all in one place.","name":"pypx","url":"https://pypx.app/"},{"@id":"https://pypx.app/packages/ansi2html#webpage","@type":"WebPage","description":"Convert text with ANSI color codes to HTML or to LaTeX","name":"ansi2html","url":"https://pypx.app/packages/ansi2html","isPartOf":{"@id":"https://pypx.app/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://pypx.app/packages/ansi2html"]}]},{"@id":"https://pypx.app/packages/ansi2html#/schema/software-application/1","@type":"SoftwareApplication","applicationCategory":"DeveloperApplication","description":"Convert text with ANSI color codes to HTML or to LaTeX","license":"GNU Lesser General Public License v3 or later (LGPLv3+)","name":"ansi2html","softwareVersion":"1.9.5"}]}
```

## Sitemap

See the full [sitemap](https://pypx.app/sitemap.md) for all pages.
