Parse the web.
The .NET way.
AngleSharp is the standards-driven engine for HTML5, CSS, SVG, MathML, and XML in .NET. Parse, query, style, script, and render documents — exactly like a browser would.
dotnet add package AngleSharp
using AngleSharp;
var context = BrowsingContext.New(Configuration.Default);
var document = await context.OpenAsync(req => req
.Content("<ul><li>One<li>Two</ul><p>Unclosed <b>tags"));
// Same error recovery as every modern browser
Console.WriteLine(document.Body!.InnerHtml);<ul><li>One</li><li>Two</li></ul><p>Unclosed <b>tags</b></p>
using AngleSharp;
using AngleSharp.Dom;
using AngleSharp.Html.Dom;
var context = BrowsingContext.New(Configuration.Default);
var document = await context.OpenAsync(req => req.Content("""
<nav>
<a href="/docs">Docs</a>
<a href="https://github.com/AngleSharp">GitHub</a>
<a href="https://www.nuget.org/packages/AngleSharp">NuGet</a>
</nav>
"""));
foreach (var a in document.QuerySelectorAll<IHtmlAnchorElement>("nav a[href^='https']"))
Console.WriteLine($"{a.TextContent} → {a.Href}");GitHub → https://github.com/AngleSharp NuGet → https://www.nuget.org/packages/AngleSharp
using AngleSharp;
using AngleSharp.Css.Dom;
using AngleSharp.Dom;
var config = Configuration.Default.WithCss();
var context = BrowsingContext.New(config);
var document = await context.OpenAsync(req => req.Content("""
<style>.alert { color: tomato }</style>
<p class="alert">Heads up!</p>
"""));
var p = document.QuerySelector(".alert")!;
var style = document.DefaultView!.GetComputedStyle(p);
Console.WriteLine(style.GetColor());rgba(255, 99, 71, 1)
using AngleSharp;
using AngleSharp.Js;
var config = Configuration.Default.WithJs();
var context = BrowsingContext.New(config);
var document = await context.OpenAsync(req => req.Content("""
<output id="out"></output>
<script>
const squares = [1, 2, 3].map(n => n * n);
document.getElementById('out').textContent = squares.join(', ');
</script>
"""));
Console.WriteLine(document.QuerySelector("#out")!.TextContent);1, 4, 9
using AngleSharp.Html.Parser;
using AngleSharp.XPath;
var parser = new HtmlParser();
var document = parser.ParseDocument("""
<table><tr><td>A</td><td>1</td></tr>
<tr><td>B</td><td>2</td></tr></table>
""");
var cells = document.Body!.SelectNodes("//tr/td[2]");
Console.WriteLine(string.Join(", ", cells.Select(c => c.TextContent)));1, 2
A browser engine core, as a library.
Everything you need to work with web content from C#, F#, or PowerShell — on any platform that runs .NET.
Standards-driven
Built from the WHATWG and W3C specifications. Malformed HTML is handled exactly like in evergreen browsers.
Fast by design
Streaming tokenizer, minimal allocations, and modern TFMs. Parse large documents in milliseconds.
The real DOM
The API you know from the browser: querySelector, events, mutation, serialization — fully interactive.
Selectors & LINQ
Powerful CSS selectors, XPath via AngleSharp.XPath, and LINQ on top of every node collection.
Modular ecosystem
A small, dependency-free core. Add CSS, JavaScript, XML, IO, or rendering only when you need it.
Extensible everywhere
Bring your own requester, cookie container, script engine, or service. Everything is configurable.
Modern HTML
template, picture, popovers, shadow DOM, custom elements — AngleSharp keeps up.
Forms & navigation
Fill, validate, and submit forms. Navigate between pages with a full browsing context.
From bytes to pixels.
Every stage of the browser pipeline is a package. Pick the ones you need — they all plug into the same BrowsingContext.
- 01FetchAngleSharp
.Io Requesters, cookies, caching - 02ParseAngleSharpHTML5 tokenizer & tree builder
- 03DOMAngleSharpNodes, events, selectors
- 04StyleAngleSharp
.Css CSSOM & computed styles - 05ScriptAngleSharp
.Js JavaScript on the DOM - 06RenderAngleSharp
.Renderer Layout & paint - 07BrowseAngleSharp
.Browser The complete engine
One core. Many capabilities.
AngleSharp
The standards-driven HTML5 parser and DOM.
AngleSharp.Css
Full CSS parser, CSSOM, and style computation.
AngleSharp.Js
Run JavaScript against the DOM via Jint.
AngleSharp.Xml
XML and DTD parsing with DOM capabilities.
AngleSharp.Io
Requesters, downloads, storage, and caching.
AngleSharp.XPath
Select nodes via XPath expressions.
AngleSharp.Diffing
Compare DOM trees and get semantic differences.
AngleSharp.Wasm
WebAssembly support for browsing contexts.
AngleSharp.Renderer
Layout and paint the styled DOM.
AngleSharp.Browser
The whole ecosystem, assembled into a browser.
Latest news.
Built in the open. Powered by people.
AngleSharp is MIT licensed and maintained by volunteers. Contributions, issues, and sponsorships keep it moving.