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

Beautiful Soup

Python HTML/XML parsing and screen-scraping library for web data extraction.

Scraping, browsers and parsingPYPI

Website

1. License

License from PyPI classifier.

crummy.com/software/BeautifulSoup/bs4/

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

What Beautiful Soup does

Beautiful Soup is a layer of simple search-and-edit methods that sits on top of parsers like lxml and html5lib, built for quick jobs on messy pages you did not write; its site says it has been saving programmers time on them since 2004.

Beautiful Soup popularity

78 / 100
Gid Score, #137 overall
76.1M
downloads a week, pypi
133
agent projects use it
Beautiful Soup: downloads per weekPyPI, beautifulsoup4 75,087,272

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

How Beautiful Soup is used

  • Beautiful Soup is a dependency in 133 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (8.2% of the 1,623 Python ones), #1 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 1,613; those are left out of every share on this page.
  • The most used alternative in our scan is lxml (79 projects).
  • Projects that use it most often also use Requests (73.7%), python-dotenv (67.7%), FastAPI (50.4%).
  • It is more common in projects set up for OpenClaw (5.1%) than for OpenAI Codex (1.7%).

By coding agent

74 projects, 2.3%
57 projects, 1.9%
50 projects, 2.0%
17 projects, 5.1%
9 projects, 1.9%
8 projects, 1.7%
5 projects, 3.6%

Often used with

In 73.7% of its projects
In 67.7% of its projects
In 50.4% of its projects
In 50.4% of its projects
In 48.9% of its projects
In 42.1% of its projects
In 40.6% of its projects
In 38.3% of its projects

Beautiful Soup in practice

Strengths

Queries that read like requests

The site's examples are phrased the way you would say them out loud, such as all links of class <code>externalLink</code> or all links whose URLs match a domain. The library "does the tree traversal stuff for you."

Unicode in, UTF-8 out

Incoming documents are converted to Unicode and outgoing ones to UTF-8. The site says you normally do not have to think about encodings.

A choice of parser underneath

Because it sits on top of lxml or html5lib, the site says you can "try out different parsing strategies or trade speed for flexibility." The site does not compare the parsers.

Drop-in bs4/ folder

Besides <code>pip install</code>, the site says the MIT license lets you download the tarball and drop the <code>bs4/</code> directory into almost any Python application.

Watch out for

Undeclared encodings need a hint

Sometimes a document does not specify its encoding and Beautiful Soup cannot detect one. In that case you have to specify the original encoding yourself.

Two similar package names

The site says Beautiful Soup 3 is "the BeautifulSoup package on pip" and does not support Python 3. It also warns that the <code>beautifulsoup</code> name will be reclaimed. When that happens, Python 2 code still on version 3 will break.

Beautiful Soup 3 code must migrate

Beautiful Soup 4 supports Python 3.7 and later. The site tells anyone with active Beautiful Soup 3 projects to move to version 4 as part of their Python 3 conversion.

More about Beautiful Soup

Head to head
Packages around it
  • requests: HTTP client
  • python-dotenv: .env config loader
  • pydantic: Data validation
  • numpy: Numerical arrays
  • fastapi: Web API framework
  • uvicorn: ASGI server
More in Scraping, browsers and parsing

Alternatives

Beautiful Soup This page

MITGid 7876.1M/wk

lxml

High-performance XML and HTML processing library combining libxml2/libxslt with Python.

BSD-3-ClauseGid 7297.5M/wk

Playwright (Python)

High-level Python API for automating browser testing and web scraping.

Apache-2.0Gid 7734.7M/wk

Selenium

Official Python bindings for browser automation and web scraping.

Apache-2.0Gid 616.5M/wk

html5lib

HTML parser based on WHATWG specification for parsing and processing HTML.

MITGid 566.9M/wk

Compare Beautiful Soup with another tool

Get started

Install it.

pip install beautifulsoup4

Rules for your agent

Paste into AGENTS.md or CLAUDE.md
## Beautiful Soup
- The site's install command is `pip install beautifulsoup4`. The `BeautifulSoup` package on pip is Beautiful Soup 3, which does not support Python 3, so do not add it as a dependency.
- Target Python 3.7 or later. Beautiful Soup 4 dropped Python 2 support on January 1, 2021.
- Pick the underlying parser (lxml or html5lib) on purpose. The site frames the choice as trying "different parsing strategies" or trading "speed for flexibility".
- If a document does not specify an encoding and Beautiful Soup cannot detect one, pass the original encoding explicitly.
- Expect parsed documents as Unicode and output as UTF-8.
- When porting Beautiful Soup 3 code, migrate it to Beautiful Soup 4 as part of the Python 3 conversion.
- File bugs on Launchpad. Report security vulnerabilities confidentially through Tidelift.

AgentGid articles about Beautiful Soup

All guides