What's the best way to convert an HTML string to plain text?

Ask a question+

Do you have a method or a C# library that converts an HTML string to a plain text?
Obviously, we need to respect as much as possible the h1, h2, h3 tags, unordered lists (i.e., ul), ordered lists (i.e., ol), etc.

Jaco 480
add comment

1 Answer


You can use the Html Agility Pack, a HTML parser for .NET, for this. One of their samples shows how to convert HTML to plain text: https://html-agility-pack.net/online-examples

Vahe Minasyan 4K
add comment

Your Answer