Skip to content

Cheerio vs jsoup

Which should you use? A side-by-side look at what each one does, who it suits, what it costs, how hard it is to set up, and where each falls short.

Cheerio

Open source · MIT

A fast library for parsing and changing HTML and XML using a jQuery-like syntax.

jsoup

Open source · MIT

A Java library for parsing, scraping, editing, and cleaning HTML and XML.

The short answer

Choose Cheerio if you need…

  • JavaScript developers who already know jQuery-style selectors
  • Writing scripts that extract text or links from static HTML pages
  • Server-side processing of HTML or XML without a browser
  • Building simple web scrapers in Node.js

Choose jsoup if you need…

  • Java developers who need to scrape or extract data from web pages
  • Backend teams that accept HTML from users and need to sanitize it
  • Projects that need to edit or tidy HTML inside a Java application
  • Developers who already know CSS selectors and want to use them in Java

Side-by-side

Cheeriojsoup
TypeLibraryLibrary
PriceFree and open sourceFree and open source
LicenceMITMIT
GitHub stars30.5k11.4k
Setup difficultyBeginnerIntermediate
How you get itInstall with a package managerInstall with a package manager
Main languageTypeScriptJava
Last code update5 days ago9 days ago

What each one is

Cheerio

Cheerio is a JavaScript and TypeScript library that loads HTML or XML text into a tree you can search and edit with jQuery-style selectors. Developers use it to pull data out of web pages, such as in scrapers, or to modify markup on the server without running a browser. Its description calls it fast, flexible, and elegant, but the README provided here was empty, so details beyond the project description are limited.

jsoup

jsoup is a Java library for working with HTML and XML found on the web. It can fetch a page from a URL, read HTML from a file or string, and let you search it with CSS selectors or DOM methods. It can also change the HTML and clean untrusted user-submitted content against a safelist to help prevent XSS attacks. It parses HTML the same way modern browsers do, so messy real-world markup still produces a usable tree.

Best for

Cheerio

  • JavaScript developers who already know jQuery-style selectors
  • Writing scripts that extract text or links from static HTML pages
  • Server-side processing of HTML or XML without a browser
  • Building simple web scrapers in Node.js

jsoup

  • Java developers who need to scrape or extract data from web pages
  • Backend teams that accept HTML from users and need to sanitize it
  • Projects that need to edit or tidy HTML inside a Java application
  • Developers who already know CSS selectors and want to use them in Java

Strengths

Cheerio

  • Familiar jQuery-style API for people who already know jQuery
  • Open source under the MIT license, with a large community (about 30,500 stars)
  • Written in TypeScript, with a published homepage at cheerio.js.org

jsoup

  • Parses HTML the way modern browsers do, based on the WHATWG HTML5 specification
  • Simple API for fetching, selecting, and changing HTML using CSS selectors or DOM methods
  • Open source under the permissive MIT license

Not ideal for

Cheerio

  • Pages whose content is filled in by JavaScript after load, because Cheerio works on the HTML it is given and does not run scripts (the README was not available to confirm this, so treat it as a general property of HTML parsers)
  • Non-developers who need a point-and-click scraping tool
  • Projects that need a browser environment with full DOM behavior

jsoup

  • Non-programmers looking for a ready-made tool; it is a code library with no interface of its own
  • Projects written in languages other than Java, since it is a Java library
  • Heavy JavaScript-rendered pages, because the README describes parsing HTML, not running scripts in a browser

Trade-offs

Cheerio

  • The README supplied for this review was empty, so setup and feature details could not be verified here
  • It parses markup but does not execute JavaScript, so content rendered client-side will not appear
  • Requires familiarity with JavaScript and HTML structure to use effectively

jsoup

  • Only usable from Java (or other JVM code), so it does not fit non-Java stacks
  • The README does not describe JavaScript execution, so dynamically rendered content may not be captured
  • Some Android use requires enabling core library desugaring, which adds setup work

Getting started

Cheerio

Clone the repository

git clone https://github.com/cheeriojs/cheerio
Step-by-step guide: how to use Cheerio

jsoup

Maven dependency

<dependency><groupId>org.jsoup</groupId><artifactId>jsoup</artifactId><version>1.23.2</version></dependency>

Gradle dependency

implementation 'org.jsoup:jsoup:1.23.1'
Step-by-step guide: how to use jsoup

Frequently asked questions

What is the difference between Cheerio and jsoup?

Cheerio: A fast library for parsing and changing HTML and XML using a jQuery-like syntax. jsoup: A Java library for parsing, scraping, editing, and cleaning HTML and XML. Cheerio suits javascript developers who already know jquery-style selectors, while jsoup suits java developers who need to scrape or extract data from web pages.

Are Cheerio and jsoup free?

Cheerio: Free and open source. jsoup: Free and open source.

Which is easier to set up, Cheerio or jsoup?

Cheerio is easier to get started with (rated beginner); jsoup is rated intermediate and usually needs more setup.

Is Cheerio or jsoup more popular?

Cheerio has more GitHub stars (30.5k) than jsoup (11.4k). Popularity isn't the same as fit — check which one matches your use case above.

What are other alternatives to Cheerio and jsoup?

Other options people compare them with include requests-html, Bootstrap, Bulma, Layui, Gentelella.

Keep comparing

Built from our catalogue entries for both products: open-source details come from each project's README (AI-assisted, refreshed weekly) and GitHub data; AI-tool details are editorial. Spotted something wrong? Let us know from either product's page.