HTML Parsers

A curated collection of the best libraries and tools for parsing HTML and extracting structured data from web page markup.

Quick answer

Choose an HTML parser by runtime and parsing model. Cheerio is the JavaScript default for jQuery-style selectors, lxml is the Python speed and XPath choice, BeautifulSoup is the forgiving Python scripting option, htmlparser2 fits streaming Node pipelines, and parse5 fits browser-accurate HTML5 behavior.

Related guides

Top picks in HTML Parsers

  1. Cheerio

    JavaScript default
    Fits JavaScript extraction code that wants a familiar jQuery-style API over static server-side HTML.
  2. BeautifulSoup

    Python scripts
    Fits Python scripts that need forgiving HTML and XML parsing with a readable navigation and search API.
  3. lxml

    Python + XPath
    Fits Python teams that need fast HTML and XML parsing, XPath support, and a parser used underneath many scraping libraries.
  4. Goquery

    Go services
    Fits Go scrapers that want jQuery-like selection while staying close to the standard net/html tokenizer.
  5. htmlparser2

    Streaming Node
    Fits Node pipelines that need lower-level streaming, event-driven parsing for large or incremental HTML inputs.
  6. parse5

    HTML5 accuracy
    Fits tooling that needs browser-style HTML5 parsing behavior rather than a lightweight selector wrapper.
Favicon

 

  
  
Favicon

 

  
  
Favicon

 

  
  
Favicon

 

  
  
Favicon

 

  
  
Favicon