lexbor/lexbor logo

lexbor/lexbor

Free

Lexbor is development of an open source HTML Renderer library. https://lexbor.com

FreeFree tier
Type
Open Source

About lexbor/lexbor

Lexbor is an open-source browser engine library written in pure C99, designed for modularity and performance. It provides a set of production-ready modules for HTML parsing, CSS processing, URL handling, Encoding, Unicode normalization, and more, all adhering to WHATWG and W3C standards. The library has been rigorously tested on over 200 million real-world web pages to ensure stability and correctness. Lexbor is used by major projects such as PHP (for its DOM/HTML extension since PHP 8.4), SerpApi for large-scale HTML parsing, the Selectolax Python library, the Nokolexbor Ruby gem, and the Nordstjernen web browser. Its zero-dependency, modular architecture allows developers to include only the components they need, making it ideal for web scraping, browser development, and high-performance web data extraction.

Key Features

High performance – one of the fastest HTML parsers available
Standards compliant – adheres to WHATWG (HTML, DOM, URL, Encoding) and W3C (CSS) specifications
Modular architecture – use only the modules you need (DOM, HTML, CSS, Selectors, URL, Encoding, Unicode, Punycode)
Zero dependencies – written in pure C99 for easy embedding and compilation
Production ready – tested on over 200 million web pages with AddressSanitizer (ASAN)
Full HTML5 parser with fragment and chunk parsing support
CSS parsing, Selectors support, and CSSOM (StyleSheet Tree) generation
Encoding module with 40+ encoding support for encode/decode
Unicode normalization and IDNA Punycode support
URL parsing according to the URL specification

Pros & Cons

Pros
  • Extremely fast HTML parsing compared to other libraries
  • Strict compliance with modern web standards ensures correct behavior
  • Modular design allows lightweight integration with minimal overhead
  • Zero external dependencies avoids dependency conflicts and simplifies builds
  • Comprehensive testing on millions of pages ensures reliability
  • Free and open-source with permissive licensing
  • Growing ecosystem of bindings across multiple languages
Cons
  • Layout and Font modules are still in development, so full browser rendering is not yet available
  • No JavaScript engine or DOM rendering included; intended as a low-level library
  • Primarily a C library, requiring C compilation knowledge and tooling to integrate
  • Documentation is primarily on the website (lexbor.com) and may not cover all advanced use cases
  • Some modules (e.g., Layout) are marked as work in progress and may be incomplete

Best For

Web scraping and HTML parsing at scale (used by SerpApi and Selectolax)Building a custom web browser (e.g., Nordstjernen)Adding DOM/HTML or CSS processing to programming languages via bindings (PHP, Python, Ruby, Elixir, Crystal, D, Julia, Erlang)High-performance web data extraction and content analysisEducational projects for understanding browser engine internals

FAQ

Is Lexbor production-ready?
Yes, the existing modules (DOM, HTML, CSS, Selectors, URL, Encoding, etc.) are production-ready and have been tested on over 200 million web pages. The library is used in production by projects like PHP, SerpApi, and Selectolax.
What are the dependencies for Lexbor?
Lexbor has zero dependencies. It is written entirely in pure C99, making it easy to build and embed in any project without external libraries.
What language bindings are available for Lexbor?
Lexbor has official or community bindings for PHP (DOM/HTML extension since PHP 8.4, URL extension since PHP 8.5), Python (Selectolax), Ruby (Nokolexbor), Elixir, Crystal, D, Julia, and Erlang.
Is Lexbor a full web browser?
No, Lexbor is a set of modular browser engine components for HTML/CSS parsing and DOM manipulation. It does not include a JavaScript engine, rendering engine, or GUI. However, it is used as a core component in the Nordstjernen web browser.
Can I use just the CSS parser without the HTML parser?
Yes, Lexbor's modular architecture allows you to use only the modules you need, such as just the CSS parser or Encoding module, keeping your application lightweight.