Download lxml – Fast XML and HTML Processing Library for Python

lxml is a fast Python library for processing XML and HTML using libxml2 and libxslt, with full XPath, XSLT, schema validation, and ElementTree API support.
Download
  • Publisher:
  • Version:
    6.0.2
  • License:
  • File Size:
    1,1 MB
  • Downloads:
    3373
  • Updated:
    22/10/2025
  • Requirements:
    Windows7,8,10,11

lxml is a high-performance Python library for processing XML and HTML documents. Built on top of the libxml2 and libxslt C libraries, it is the fastest and most feature-complete XML toolkit available for Python — combining the speed of native C code with the ease of a clean, Pythonic API.

lxml fully supports the ElementTree API (compatible with Python’s built-in xml.etree.ElementTree) while extending it with XPath 1.0, XSLT, XML Schema validation, RelaxNG, and more. Its HTML parser can also handle real-world messy HTML (like BeautifulSoup), making lxml an excellent choice for both structured XML processing and web scraping tasks.

Whether you are parsing large XML data feeds, transforming documents with XSLT stylesheets, validating against schemas, or scraping web pages, lxml provides the best combination of speed, correctness, and feature coverage of any Python XML library.

Key Features

  • Extremely fast XML and HTML parsing backed by the native libxml2 C library
  • Full XPath 1.0 support for powerful document querying and data extraction
  • XSLT transformation support for converting XML documents using stylesheets
  • XML Schema (XSD), RelaxNG, and Schematron validation
  • Compatible with Python’s ElementTree API for easy drop-in replacement
  • Lenient HTML parser that handles malformed real-world web pages
  • CSS selector support via the cssselect integration for HTML scraping
lxml Python XML and HTML parsing example lxml XPath query and document processing

How to Install

  1. Click the download button below or install via pip: pip install lxml
  2. On Windows, pip will automatically download a prebuilt binary wheel — no compiler needed.
  3. On Linux, you may need libxml2 and libxslt dev packages: sudo apt install libxml2-dev libxslt-dev
  4. Import lxml in your Python script: from lxml import etree or from lxml import html
  5. Parse an XML or HTML document: tree = etree.parse('file.xml') and query with XPath.

Other Versions
Search: