selectolax
A fast HTML5 parser with CSS selectors, written in Cython, using Modest and Lexbor engines.
Decision gist · record as of 2026-08-14
Yes. selectolax is actively maintained, has no security vulnerabilities, uses a permissive MIT license, and offers a significant speed advantage over pure-Python HTML parsers for typical web-scraping tasks. Install friction is medium but manageable thanks to pre-built wheels. Choose it if parsing performance matters or if you need CSS selector support; it's a solid, production-ready choice for HTML extraction work.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.9 or later; compiled wheels are provided for most platforms but compilation from source requires a C compiler and Cython.
- Medium install friction due to compiled Cython components; pre-built wheels are available for Python 3.9–3.14 on macOS, Linux, Windows, and ARM architectures.
- Installation typically succeeds without intervention, though older versions on newer Python releases may require Cython to be installed separately.
License · maintenance · safety
MIT (permissive) — MIT license (permissive). The underlying Modest engine uses LGPL2.1 and Lexbor uses Apache-2.0, but selectolax itself is MIT, allowing use in proprietary and commercial projects without copyleft obligations.
last release 2026-07-15 (30 days) · last repo commit 2026-07-15 · 1,663 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 6,064,384 downloads/mo, #1,976 on PyPI
Alternatives
Verify before relying
from selectolax.lexbor import LexborHTMLParser
html = '<h1 id="title">Hi there</h1><p class="post">Lorem ipsum</p>'
tree = LexborHTMLParser(html)
print(tree.css_first('h1#title').text())
print([node.text() for node in tree.css('.post')])- Whether the Lexbor backend is materially faster than Modest in typical web-scraping workloads beyond the benchmark shown.
- Performance characteristics when parsing very large HTML documents or handling malformed HTML.
- Whether the `lexbor-contains` pseudo-class and advanced CSS selectors cover all real-world scraping patterns.
What it is and what it does
selectolax wraps the Lexbor and Modest C HTML5 parsing engines in Cython to provide a fast, Python-friendly interface for parsing and querying HTML. It supports standard CSS selectors and some extended pseudo-classes (like `:lexbor-contains` for text matching), and exposes parsed nodes with methods to extract text, attributes, and HTML fragments. The package is designed for web scraping and data extraction tasks where parsing speed matters.
The library has no runtime dependencies and comes as pre-compiled wheels for modern Python versions (3.9–3.14) on major platforms. Installation is straightforward on supported configurations; older or edge-case Python versions may require building from source. The Lexbor backend is now preferred over Modest, which is maintained for backward compatibility only.
Use it for
- Extract structured data from web pages during web scraping by querying elements with CSS selectors and reading text or attributes.
- Parse and filter large HTML documents quickly when performance is critical, such as processing thousands of pages in batch jobs.
- Find elements matching complex CSS selectors including pseudo-classes like `:nth-child` and `:not`, or text-based matching with `:lexbor-contains`.
- Build DOM navigation tools that need to traverse parent and sibling nodes after selecting an element.
- Replace slower pure-Python HTML parsers in existing projects when parsing becomes a bottleneck.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
selectolax is actively maintained, has no security vulnerabilities, uses a permissive MIT license, and offers a significant speed advantage over pure-Python HTML parsers for typical web-scraping tasks. Install friction is medium but manageable thanks to pre-built wheels. Choose it if parsing performance matters or if you need CSS selector support; it's a solid, production-ready choice for HTML extraction work.
Install
selectolax on PyPI
Before you install
Medium install friction due to compiled Cython components; pre-built wheels are available for Python 3.9–3.14 on macOS, Linux, Windows, and ARM architectures. Installation typically succeeds without intervention, though older versions on newer Python releases may require Cython to be installed separately.
Requires Python 3.9 or later; compiled wheels are provided for most platforms but compilation from source requires a C compiler and Cython.
License in practice
MIT license (permissive). The underlying Modest engine uses LGPL2.1 and Lexbor uses Apache-2.0, but selectolax itself is MIT, allowing use in proprietary and commercial projects without copyleft obligations.
Quickstart
from selectolax.lexbor import LexborHTMLParser
html = '<h1 id="title">Hi there</h1><p class="post">Lorem ipsum</p>'
tree = LexborHTMLParser(html)
print(tree.css_first('h1#title').text())
print([node.text() for node in tree.css('.post')])
Verify before relying
- Whether the Lexbor backend is materially faster than Modest in typical web-scraping workloads beyond the benchmark shown.
- Performance characteristics when parsing very large HTML documents or handling malformed HTML.
- Whether the `lexbor-contains` pseudo-class and advanced CSS selectors cover all real-world scraping patterns.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release <3.15,>=3.9 |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 30 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 6,064,384 / month, #1,976 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 :: Web EnvironmentIntended Audience :: DevelopersNatural Language :: EnglishOperating System :: MacOSOperating System :: Microsoft :: WindowsOperating System :: OS IndependentOperating System :: UnixProgramming Language :: CythonProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonTopic :: InternetTopic :: Internet :: WWW/HTTPTopic :: Software DevelopmentTopic :: Software Development :: LibrariesTopic :: Software Development :: Libraries :: Python ModulesTopic :: Text ProcessingTopic :: Text Processing :: MarkupTopic :: Text Processing :: Markup :: HTMLTyping :: Typed |
Evidence: selectolax-0.4.11-cp310-cp310-macosx_10_9_x86_64.whl; selectolax-0.4.11-cp310-cp310-macosx_11_0_arm64.whl; selectolax-0.4.11-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; selectolax-0.4.11-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; selectolax-0.4.11-cp310-cp310-musllinux_1_2_aarch64.whl; selectolax-0.4.11-cp310-cp310-musllinux_1_2_x86_64.whl; selectolax-0.4.11-cp310-cp310-win32.whl; selectolax-0.4.11-cp310-cp310-win_amd64.whl; selectolax-0.4.11-cp310-cp310-win_arm64.whl; selectolax-0.4.11-cp311-cp311-macosx_10_9_x86_64.whl; selectolax-0.4.11-cp311-cp311-macosx_11_0_arm64.whl; selectolax-0.4.11-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; selectolax-0.4.11-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; selectolax-0.4.11-cp311-cp311-musllinux_1_2_aarch64.whl; selectolax-0.4.11-cp311-cp311-musllinux_1_2_x86_64.whl; selectolax-0.4.11-cp311-cp311-win32.whl; selectolax-0.4.11-cp311-cp311-win_amd64.whl; selectolax-0.4.11-cp311-cp311-win_arm64.whl; selectolax-0.4.11-cp312-cp312-macosx_10_13_x86_64.whl; selectolax-0.4.11-cp312-cp312-macosx_11_0_arm64.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 › “fast html parser python”
- selectolaxselectolax is a fast HTML5 parser with CSS selector support, written…
- pyromarkpyromark is a CommonMark-compliant Markdown parser that converts…
- mistuneMistune converts Markdown text to HTML using a fast parser with…
Give your agent the search over MCP, or paste the wish link into any chat.
More Software Development packages
Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.
Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.
Install it if you are building CLIs in Python.
Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.
See also cssselect · soupsieve · parsel · cssselect2 · turbohtml · itemloaders · selectors2 · BeautifulSoup · requests-html · Selenium-Screenshot