Skip to content
Agents tracked: 506 Releases (7d): 634 Agent status: 3 with issuesSince last limit reset: Claude 15d · Codex 0d For AI agents: Markdown Updated Nov 26, 2026

Cheerio

jQuery-like syntax for parsing and manipulating HTML/XML with server-side speed.

Scraping, browsers and parsingNPM

GitHubWebsiteAPI page

1. License

License from npm.

github.com/cheeriojs/cheerio

From the package registry and GitHub, checked daily. Tap a verdict to see its source.How we checkedReport an error

What Cheerio does

Cheerio gives you jQuery's selector-and-chain API over an HTML or XML string you load yourself, with no browser DOM underneath.

Cheerio popularity

78 / 100
Gid Score, #132 overall
37.4M
downloads a week, npm
30.6K
GitHub stars
76
agent projects use it
Cheerio: downloads per weeknpm, cheerio 37,434,618
Cheerio: GitHub starscheeriojs/cheerio 30,553

Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated

How Cheerio is used

  • Cheerio is a dependency in 76 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (1.6% of the 4,867 JavaScript/TypeScript ones), #6 of 141 in scraping, browsers and parsing.
  • Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 313; those are left out of every share on this page.
  • The most used alternative in our scan is Puppeteer (86 projects).
  • Projects that use it most often also use Axios (44.7%), dotenv (47.4%), TypeScript (81.6%).

By coding agent

37 projects, 1.2%
33 projects, 1.0%
32 projects, 1.3%
8 projects, 1.7%
8 projects, 2.3%
7 projects, 2.5%
5 projects, 1.5%

Often used with

In 44.7% of its projects
In 47.4% of its projects
In 81.6% of its projects
In 59.2% of its projects
In 50.0% of its projects
In 55.3% of its projects
In 56.6% of its projects
In 36.8% of its projects

Cheerio in practice

Strengths

jQuery calls work on server-side HTML

The API is a subset of core jQuery. Selectors like <code>$('ul .pear')</code> and methods like <code>.text()</code>, <code>.attr()</code> and <code>.addClass()</code> carry over. The maintainers say they removed the DOM inconsistencies and browser cruft.

Two parsers to choose from

Cheerio parses HTML with parse5 by default. The README says it can optionally use htmlparser2, which it calls "forgiving".

HTML and XML, browser and server

The README says it can handle "nearly any" HTML or XML document and works in both environments.

Speed comes from a simpler DOM model

The maintainers say a "very simple, consistent DOM model" makes parsing, manipulating and rendering efficient. A screencast linked from the README claims Cheerio is faster than JSDOM + jQuery. No figures are given.

Watch out for

Not all of jQuery

Cheerio implements only a subset of core jQuery. Do not assume every jQuery method you know is present.

There is no ambient document

jQuery works on the page's built-in DOM. Cheerio has none, so every document must be passed to <code>cheerio.load()</code> first.

Fragments come back wrapped

The README examples show that loading a fragment and calling <code>$.html()</code> returns it wrapped in <code>&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;</code>. For a single element's markup, the README uses <code>.prop('outerHTML')</code> instead.

Load, select, modify, render

import * as cheerio from 'cheerio';
const $ = cheerio.load('<h2 class="title">Hello world</h2>');

$('h2.title').text('Hello there!');
$('h2').addClass('welcome');

$.html();
//=> <html><head></head><body><h2 class="title welcome">Hello there!</h2></body></html>

More about Cheerio

Funding
  • GitHub Sponsors: https://github.com/cheeriojs
  • GitHub Sponsors: https://github.com/fb55
  • Open Collective: https://opencollective.com/cheerio
  • Own page: https://github.com/cheeriojs/cheerio?sponsor=1
  • 4 GitHub sponsors

See all

Packages around it
  • axios: HTTP client
  • dotenv: Env variables
  • zod: Schema validation
  • express: Web server
  • tailwindcss: Utility CSS
  • tsx: Run TypeScript
More in Scraping, browsers and parsing

Alternatives

Cheerio This page

MITGid 7837.4M/wk

Puppeteer

Headless Chrome/Chromium automation for scraping, testing and screenshot generation.

Apache-2.0Gid 8016M/wk

linkedom

Lightweight DOM implementation using linked lists for Node.js.

ISCGid 6210.5M/wk

parse5

Fast, spec-compliant HTML parser and serializer for Node.js and browsers.

MITGid 66255M/wk

xml2js

XML to JavaScript object parser for handling XML data in applications.

MITGid 6665.6M/wk

Compare Cheerio with another tool

Get started

Install it.

npm install cheerio

Rules for your agent

Paste into AGENTS.md or CLAUDE.md
## Cheerio
- Import with `import * as cheerio from 'cheerio'` in ESM or TypeScript, and `const cheerio = require('cheerio')` elsewhere.
- Always call `cheerio.load(html)` first. There is no implicit document like jQuery's.
- Query with `$(selector, [context], [root])`. `context` scopes the search, as in `$('.apple', '#fruits')`.
- Only a subset of core jQuery exists. Check the docs before using a jQuery method.
- `$.html()` and `$.root().html()` render a full document with `<html><head><body>` added. Use `$(sel).prop('outerHTML')` for one element's markup.
- Use `.text()` for text content. Rely only on the node properties the README lists: `tagName`, `parentNode`, `previousSibling`, `nextSibling`, `nodeValue`, `firstChild`, `childNodes`, `lastChild`.