{
 "kind": "tool",
 "slug": "beautifulsoup4",
 "path": "tools/beautifulsoup4/",
 "name": "Beautiful Soup",
 "maker": null,
 "density": "profile",
 "crumbs": [
  [
   "Tools",
   "tools/"
  ],
  [
   "Scraping, browsers and parsing",
   "tools/scraping-parsing/"
  ]
 ],
 "lead": "Python HTML/XML parsing and screen-scraping library for web data extraction.",
 "chips": [
  {
   "label": "Scraping, browsers and parsing",
   "path": "tools/scraping-parsing/"
  },
  {
   "label": "PYPI"
  }
 ],
 "primary": {
  "label": "Copy install command",
  "copy": "pip install beautifulsoup4"
 },
 "links": [
  {
   "label": "Website",
   "href": "https://www.crummy.com/software/BeautifulSoup/bs4/"
  }
 ],
 "track": "New versions, deprecation and license changes on your dashboard",
 "verdicts": [
  {
   "key": "license",
   "label": "License",
   "value": "MIT",
   "status": "yes",
   "sub": "Use it in paid apps",
   "quote": null,
   "note": "License from PyPI classifier.",
   "src": "https://www.crummy.com/software/BeautifulSoup/bs4/"
  },
  {
   "key": "maint",
   "label": "Maintained",
   "value": "Not checked yet",
   "status": "unknown",
   "sub": null,
   "note": "",
   "src": "https://www.crummy.com/software/BeautifulSoup/bs4/"
  },
  {
   "key": "pop",
   "label": "Used by agents' projects",
   "value": "133 projects",
   "status": "info",
   "sub": "#1 of 141 in its category",
   "note": "Dependency in 133 public GitHub projects set up for AI coding agents that we scanned (2.1%).",
   "src": null
  },
  {
   "key": "agent",
   "label": "Agent access",
   "value": "Install only",
   "status": "info",
   "sub": null,
   "note": "Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.",
   "src": null
  }
 ],
 "vfoot": "From the package registry and GitHub, checked daily.",
 "blocks": [
  {
   "id": "overview",
   "nav": "Overview",
   "h2": "What Beautiful Soup does",
   "parts": [
    {
     "t": "prose",
     "text": "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."
    }
   ]
  },
  {
   "id": "popularity",
   "nav": "Popularity",
   "h2": "Beautiful Soup popularity",
   "parts": [
    {
     "t": "stats",
     "items": [
      {
       "n": "78",
       "of": "/ 100",
       "l": "Gid Score, #137 overall"
      },
      {
       "n": "76.1M",
       "l": "downloads a week, pypi"
      },
      {
       "n": "133",
       "l": "agent projects use it"
      }
     ]
    },
    {
     "t": "small",
     "text": "Gid Score measures public popularity and activity, not quality.",
     "link": "How the Gid Score is calculated",
     "path": "tools/top/"
    }
   ]
  },
  {
   "id": "usage",
   "nav": "How it is used",
   "h2": "How Beautiful Soup is used",
   "parts": [
    {
     "t": "list",
     "items": [
      "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%)."
     ]
    },
    {
     "t": "h3",
     "text": "By coding agent"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "74 projects, 2.3%",
       "v": "Claude Code",
       "path": "agents/claude-code/"
      },
      {
       "l": "57 projects, 1.9%",
       "v": "GitHub Copilot",
       "path": "agents/github-copilot/"
      },
      {
       "l": "50 projects, 2.0%",
       "v": "Cursor",
       "path": "agents/cursor/"
      },
      {
       "l": "17 projects, 5.1%",
       "v": "OpenClaw",
       "path": "agents/openclaw/"
      },
      {
       "l": "9 projects, 1.9%",
       "v": "Gemini CLI",
       "path": "agents/gemini-cli/"
      },
      {
       "l": "8 projects, 1.7%",
       "v": "OpenAI Codex",
       "path": "agents/openai-codex/"
      },
      {
       "l": "5 projects, 3.6%",
       "v": "Kiro",
       "path": "agents/kiro/"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Often used with"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "In 73.7% of its projects",
       "v": "Requests",
       "path": "tools/requests-py/"
      },
      {
       "l": "In 67.7% of its projects",
       "v": "python-dotenv",
       "path": "tools/python-dotenv/"
      },
      {
       "l": "In 50.4% of its projects",
       "v": "FastAPI",
       "path": "tools/fastapi/"
      },
      {
       "l": "In 50.4% of its projects",
       "v": "Uvicorn",
       "path": "tools/uvicorn/"
      },
      {
       "l": "In 48.9% of its projects",
       "v": "Pydantic",
       "path": "tools/pydantic/"
      },
      {
       "l": "In 42.1% of its projects",
       "v": "lxml",
       "path": "tools/lxml/"
      },
      {
       "l": "In 40.6% of its projects",
       "v": "Pillow",
       "path": "tools/pillow/"
      },
      {
       "l": "In 38.3% of its projects",
       "v": "NumPy",
       "path": "tools/numpy/"
      }
     ]
    }
   ]
  },
  {
   "id": "profile",
   "nav": "Profile",
   "h2": "Beautiful Soup in practice",
   "parts": [
    {
     "t": "h3",
     "text": "Strengths"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "Queries that read like requests",
       "v": "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.\""
      },
      {
       "l": "Unicode in, UTF-8 out",
       "v": "Incoming documents are converted to Unicode and outgoing ones to UTF-8. The site says you normally do not have to think about encodings."
      },
      {
       "l": "A choice of parser underneath",
       "v": "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."
      },
      {
       "l": "Drop-in bs4/ folder",
       "v": "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."
      }
     ]
    },
    {
     "t": "h3",
     "text": "Watch out for"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "Undeclared encodings need a hint",
       "v": "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."
      },
      {
       "l": "Two similar package names",
       "v": "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."
      },
      {
       "l": "Beautiful Soup 3 code must migrate",
       "v": "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."
      }
     ]
    }
   ]
  },
  {
   "id": "more",
   "nav": null,
   "spy_as": "profile",
   "h2": "More about Beautiful Soup",
   "parts": [
    {
     "t": "more",
     "items": [
      {
       "title": "Head to head",
       "items": [
        {
         "text": "Beautiful Soup vs lxml",
         "note": "used together in 56 projects",
         "path": "tools/compare/beautiful-soup-vs-lxml/"
        }
       ]
      },
      {
       "title": "Packages around it",
       "items": [
        "requests: HTTP client",
        "python-dotenv: .env config loader",
        "pydantic: Data validation",
        "numpy: Numerical arrays",
        "fastapi: Web API framework",
        "uvicorn: ASGI server"
       ]
      },
      {
       "title": "More in Scraping, browsers and parsing",
       "path": "tools/scraping-parsing/",
       "items": [
        {
         "text": "Puppeteer",
         "path": "tools/puppeteer/"
        },
        {
         "text": "Playwright Core",
         "path": "tools/playwright-core/"
        },
        {
         "text": "Cheerio",
         "path": "tools/cheerio/"
        },
        {
         "text": "fast-xml-parser",
         "path": "tools/fast-xml-parser/"
        },
        {
         "text": "jsonc-parser",
         "path": "tools/jsonc-parser/"
        },
        {
         "text": "Mozilla Readability",
         "path": "tools/mozilla-readability/"
        },
        {
         "text": "linkedom",
         "path": "tools/linkedom/"
        },
        {
         "text": "Puppeteer Core",
         "path": "tools/puppeteer-core/"
        }
       ]
      }
     ]
    }
   ]
  },
  {
   "id": "alternatives",
   "nav": "Alternatives",
   "h2": "Alternatives",
   "parts": [
    {
     "t": "alts",
     "items": [
      {
       "name": "Beautiful Soup",
       "me": true,
       "facts": [
        "MIT",
        "Gid 78",
        "76.1M/wk"
       ]
      },
      {
       "name": "lxml",
       "why": "High-performance XML and HTML processing library combining libxml2/libxslt with Python.",
       "path": "tools/lxml/",
       "facts": [
        "BSD-3-Clause",
        "Gid 72",
        "97.5M/wk"
       ]
      },
      {
       "name": "Playwright (Python)",
       "why": "High-level Python API for automating browser testing and web scraping.",
       "path": "tools/playwright/",
       "facts": [
        "Apache-2.0",
        "Gid 77",
        "34.7M/wk"
       ]
      },
      {
       "name": "Selenium",
       "why": "Official Python bindings for browser automation and web scraping.",
       "path": "tools/selenium/",
       "facts": [
        "Apache-2.0",
        "Gid 61",
        "6.5M/wk"
       ]
      },
      {
       "name": "html5lib",
       "why": "HTML parser based on WHATWG specification for parsing and processing HTML.",
       "path": "tools/html5lib/",
       "facts": [
        "MIT",
        "Gid 56",
        "6.9M/wk"
       ]
      }
     ],
     "more": "Compare Beautiful Soup with another tool",
     "more_path": "tools/compare/"
    }
   ]
  },
  {
   "id": "start",
   "nav": "Get started",
   "h2": "Get started",
   "parts": [
    {
     "t": "install",
     "intro": "Install it.",
     "code": "pip install beautifulsoup4"
    },
    {
     "t": "h3",
     "text": "Rules for your agent"
    },
    {
     "t": "rules",
     "label": "Paste into AGENTS.md or CLAUDE.md",
     "text": "## Beautiful Soup\n- 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.\n- Target Python 3.7 or later. Beautiful Soup 4 dropped Python 2 support on January 1, 2021.\n- Pick the underlying parser (lxml or html5lib) on purpose. The site frames the choice as trying \"different parsing strategies\" or trading \"speed for flexibility\".\n- If a document does not specify an encoding and Beautiful Soup cannot detect one, pass the original encoding explicitly.\n- Expect parsed documents as Unicode and output as UTF-8.\n- When porting Beautiful Soup 3 code, migrate it to Beautiful Soup 4 as part of the Python 3 conversion.\n- File bugs on Launchpad. Report security vulnerabilities confidentially through Tidelift.\n"
    }
   ]
  }
 ],
 "glance": [
  [
   "Package",
   "pypi beautifulsoup4"
  ],
  [
   "Category",
   "Scraping, browsers and parsing"
  ],
  [
   "License",
   "MIT"
  ],
  [
   "Latest version",
   "4.15.0, June 7, 2026"
  ],
  [
   "Gid Score",
   "77.8"
  ],
  [
   "Rank in category",
   "#1 of 141"
  ]
 ],
 "good": [
  "Used by The developers of Python, The Lawrence Journal-World, NOAA's Forecast Applications Branch, as listed by the source; we have not checked each one."
 ],
 "checked_line": "From the package registry, GitHub and our scan of public agent projects; numbers update daily.",
 "logo": null
}