AngleSharp parses HTML5, SVG, MathML, and CSS into a W3C-style DOM for .NET, with LINQ-friendly traversal and optional browsing contexts.
Overview
AngleSharp is a .NET library for parsing angle-bracket markup and related CSS according to W3C specifications. It builds in-memory DOM trees that align with browser APIs such as querySelectorAll.
The parser targets HTML 5.1 rules with defined error handling, and XML without validation is also supported. CSS parsing covers selectors and declarations used alongside documents.
Developers use it for HTML fragments, crawling, testing, automation, and tools that need standards-close DOM behavior in C#. It ships for netstandard2.0 and recent .NET versions with optional legacy Windows targets.
Extension packages in the ecosystem add scripting, CSS minification, and other services on top of the core parser.
Key features
- HTML5, SVG, and MathML parsing
- CSS and selector parsing
- W3C-aligned DOM with LINQ
- Async document loading via browsing contexts
- Form submission and navigation hooks
- Portable netstandard2.0 builds
Use cases
- Scraping and crawling HTML in C#
- Unit testing HTML or DOM behavior
- Building server-side web automation
- Parsing CSS or markup in developer tools