# Beautiful Soup — card for AI agents

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

Category: Scraping, browsers and parsing · PyPI package `beautifulsoup4` · latest version 4.15.0 (checked 2026-11-01)
Install: `pip install beautifulsoup4`
License: MIT (permissive)

In your own product (generator, app, hosted service): **yes**. Permissive license: ship it inside your own product, closed or open source, and keep its license and copyright notice.

## Rules for AI agents (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.

## What it is
- Beautiful Soup is a Python library for pulling data out of web pages. Its site opens with "You didn't write that awful page. You're just trying to get some data out of it." It calls the library "designed for quick turnaround projects like screen-scraping." The package is `beautifulsoup4` on PyPI, and it is MIT licensed.
- The site says it "sits on top of popular Python parsers like lxml and html5lib". On top of them it adds "a few simple methods and Pythonic idioms for navigating, searching, and modifying a parse tree". It also converts documents to Unicode on the way in and to UTF-8 on the way out.
- The site's examples show the intended use: find all links, find links of a given class, or find the table heading with bold text and return its text. Development happens at Launchpad. The site is part of Crummy, the webspace of Leonard Richardson. Enterprise support is available via Tidelift.

## Caveats
- 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 `beautifulsoup` 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.
- Two version numbers in circulation: The project site names 4.14.3 (November 30, 2025) as the current release. The PyPI page lists 4.15.0, published 2026-06-07.
- Bugs on Launchpad, security via Tidelift: Questions go to a discussion group, and bugs are filed on Launchpad. Security vulnerabilities are reported confidentially through Tidelift.

## Numbers (AgentGid data)
- Gid Score: 77.8 (#137 of all tools, 5 of 141 in its category)
- Used in 133 public projects set up for AI coding agents (2.1%)
- Downloads last week: 76,078,221 (as of 2026-11-24), +6.6% over 4 weeks

## Often used with
Requests 73.7%, python-dotenv 67.7%, FastAPI 50.4%, Uvicorn 50.4%, Pydantic 48.9%, lxml 42.1%

## Checked alternatives (same job)
- lxml: https://agentgid.com/tools/lxml/agent.md
- Playwright (Python): https://agentgid.com/tools/playwright/agent.md
- Selenium: https://agentgid.com/tools/selenium/agent.md
- html5lib: https://agentgid.com/tools/html5lib/agent.md

## Links
- AgentGid page: https://agentgid.com/tools/beautifulsoup4/
- Homepage: https://www.crummy.com/software/BeautifulSoup/bs4/
- Source: https://pypi.org/project/beautifulsoup4/
- Source: https://www.crummy.com/software/BeautifulSoup/bs4/

---
AgentGid's catalog is curated: every entry was checked against the maker's official pages (registry, repository, license and pricing pages) on the date shown; a license value shows the quote it stands on wherever AgentGid has one. Usage numbers come from AgentGid's own scan of public repositories set up for AI coding agents. Claims by makers are reported, not tested by AgentGid.
