AngleSharp /AngleSharp
:angel: The ultimate angle brackets parser library parsing HTML5, MathML, SVG and CSS to construct a DOM based on the official W3C specifications.
★ 5,551⑂ 597👁 181⑃ 484● 908▤ 80
+0
Daily
5,551
stars
597
forks
181
watchers
484
prs
908
issues
80
releases
README
!logo AngleSharp AngleSharp is a .NET library that gives you the ability to parse angle bracket based hyper-texts like HTML, SVG, and MathML. XML without validation is also supported by the library. An important aspect of AngleSharp is that CSS can also be parsed. The included parser is built upon the official W3C specification. This produces a perfectly portable HTML5 DOM representation of the given source code and ensures compatibility with results in evergreen browsers. Also standard DOM features such as querySelector or querySelectorAll work for tree traversal. :zap: Migrating from AngleSharp 0.9 to AngleSharp 0.10 or later (incl. 1.0)? Look at our migration documentation. :zap: Key Features - Portable (using .NET Standard 2.0) - Standards conform (works exactly as evergreen browsers) - Great performance (outperforms similar parsers in most scenarios) - Extensible (extend with your own services) - Useful abstractions (type helpers, jQuery like construction) - Fully functional DOM (all the lists, iterators, and events you know) - Form submission (easily log in everywhere) - Navigation (a BrowsingContext is like a browser tab - control it from .NET!). - LINQ enhanced (use LINQ with DOM elements, naturally without wrappers) The advantage over similar libraries like HtmlAgilityPack is that the exposed DOM is using the official W3C specified API, i.e., that even things like querySelectorAll are available in AngleSharp. Also the parser uses the HTML 5.1 specification, which defines error handling and element correction. The AngleSharp library focuses on standards compliance, interactivity, and extensibility. It is therefore giving web developers working with C all possibilities as they know from using the DOM in any modern browser. The performance of AngleSharp is quite close to the performance of browsers. Even very large pages can be processed within milliseconds. AngleSharp tries to minimize memory allocations and reuses elements internally to avoid unnecessary object creation. Simple Demo The simple example will use the website of Wikipedia for data retrieval. cs var config = Configuration.Default.WithDefaultLoader(); var address = "https://en.wikipedia.org/wiki/List_of_The_Big_Bang_Theory_episodes"; var context = BrowsingContext.New(config); var document = await context.OpenAsync(address); var cellSelector = "tr.vevent td:nth-child(3)"; var cells = document.QuerySelectorAll(cellSelector); var titles = cells.Select(m = m.TextContent); Or the same with explicit types: cs IConfiguration config = Configuration.Default.WithDefaultLoader(); string address = "https://en.wikipedia.org/wiki/List_of_The_Big_Bang_Theory_episodes"; IBrowsingContext context = BrowsingContext.New(config); IDocument document = await context.OpenAsync(address); string cellSelector = "tr.vevent td:nth-child(3)"; IHtmlCollection cells = document.QuerySelectorAll(cellSelector); IEnumerable titles = cells.Select(m = m.TextContent); In the example we see:
Top issues
#1163Request for Support / Sponsorship5 comments · 2024-01-18#1408Version 2 - Umbrella Issue1 comments · 2026-11-06#1264Allow asynchronous alternative token sources to feed HTML tree construction1 comments · 2026-07-16
Latest release
v1.10.3 v1.10.3 2026-11-13Released on Friday, November 13 2026. What's Changed - Fixed events of a document's nodes not reaching its window (except load) - Fixed composedPath() of an event giving scripts no array and not starting with the target - Fixed a script element parsed with another type never running once a script gives it a source - Fixed other scripts running between a script and its load event when there is an event loop, so that SystemJS gave modules the registration of another script (e.g. failing micro frontends loaded with it) - Fixed the code of a keyboard event created from a key value being