# html5lib/html5lib-python

Standards-compliant library for parsing and serializing HTML documents and fragments in Python

Repository: https://github.com/html5lib/html5lib-python
Canonical: https://ross.abutalabs.com/products/html5lib-python
Language: Python
License: MIT
License Family: permissive
Last push: 2026-04-21T20:44:04+00:00

## Health v2 (maintenance only)
Score: 67/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 78, release rhythm 35, longevity 100
- inputs: {"age_days": 4894, "days_push": 134, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1223, forks 308 (observed 2026-08-28T04:04:02.671260+00:00)

## What it is
html5lib is a pure-Python library for parsing and serializing HTML documents and fragments according to the WHATWG HTML specification, matching browser behavior. It supports multiple tree formats including ElementTree, minidom, and lxml.

## Use cases
- parse html documents in python
- parse malformed html like a browser would
- extract data from html pages
- serialize html fragments
- convert html to lxml or minidom trees
- strict html validation with parse errors

## When to choose
- you need browser-identical HTML5 parsing behavior
- you must handle broken or real-world HTML robustly
- you need a pure-Python parser with no C dependencies

## When to avoid
- you only need fast parsing of well-formed HTML (lxml is faster)
- you need to parse XML rather than HTML
- you need active feature development rather than maintenance

## Facets
- artifact type: library
- maturity: maintenance
- function: parser, serialization
- domain: web-development, parsers, developer-tools
- platform: python
- tags: html-parsing, whatwg-html5, pure-python, web-scraping-support

## Member repositories
- html5lib/html5lib-python (main) score 67

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:04:02.671260+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T06:15:32.774450+00:00, confidence not recorded.
  - readme: https://github.com/html5lib/html5lib-python (fetched 2026-08-28T04:04:02.671260+00:00, sha 88f014628c7b)
- Data as of 2026-08-30T08:39:29.467469+00:00.
