lexborisov/myhtml
FreeFast C/C++ HTML 5 Parser. Using threads.
FreeFree tier
About lexborisov/myhtml
MyHTML is a fast, pure C99 HTML parser with threading support, fully conformant to the HTML5 specification. It supports asynchronous parsing, tree construction, and element/attribute manipulation. The library handles 39 character encodings, includes encoding detection, supports fragment parsing, and can parse input by chunks. With no external dependencies, it passes all tree construction tests from html5lib-tests and has been tested on over 1 billion HTML pages from CommonCrawl. The project is now superseded by the Lexbor parser, which offers more features and continued development.
Key Features
Asynchronous parsing with threading
Full HTML5 specification conformance
Two API levels (high and low)
Element and attribute manipulation (add, change, delete)
Support for 39 character encodings
Automatic character encoding detection
Fragment parsing and single mode parsing
Chunked parsing (streaming input)
No external dependencies (pure C99)
Passes html5lib-tests tree construction tests
Pros & Cons
Pros
- Exceptionally fast due to multithreaded design
- Standards-compliant and thoroughly tested
- Lightweight with zero external dependencies
- Supports a wide range of character encodings
- Simple C API with both high-level and low-level interfaces
- Proven reliability on billions of real-world pages
Cons
- No longer actively developed; users are encouraged to migrate to the Lexbor parser
- Limited to HTML parsing; CSS selector support requires separate libraries (e.g., Modest)
- C library only; higher-level language bindings are community-maintained and may lag
- Documentation and examples are minimal beyond the GitHub README
Best For
Building fast HTML crawlers and scrapersEmbedding HTML parsing in C/C++ applicationsProcessing large-scale HTML datasets (e.g., CommonCrawl)HTML sanitization and transformation toolsEducational projects exploring HTML parsing standards
FAQ
Is MyHTML still maintained?
MyHTML is no longer actively developed. The project's README advises users to use the HTML parser from the Lexbor project, which is stable, has more features, and is very fast.
What makes MyHTML fast?
MyHTML uses threads for asynchronous parsing and is implemented as a pure C99 library with no overhead from dependencies, enabling high-speed HTML5 parsing.
Does MyHTML support all HTML5 features?
Yes, MyHTML is fully conformant with the HTML5 specification and passes all tree construction tests from html5lib-tests.