How to extract Text from HTML using C# and VB.Net in .NET?
Key Features
>>HTML to Text
Merge RTF
Download trial
Code examples
Video Tutorials
Version History

How to extract Text from HTML using C# and VB.Net in .NET?

How to extract Text from HTML using C# and VB.Net in .NET?


    Rest assured, if you are looking a .NET solution how to extract a Text from HTML document, you are in the right place. To illustrate, let's see the simplest C# code:

                  SautinSoft.HtmlToRtf h = new SautinSoft.HtmlToRtf();
            string htmlString = "Hello World!";
            string outputFile = @"c:\Test\result.txt";

            if (h.OpenHtml(htmlString))
                bool ok = h.ToText(outputFile);

                // Open the result for demonstration purposes.
                if (ok)
                    System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outputFile) { UseShellExecute = true });
To get the ability of HTML conversion in you .NET application:
  • Download the latest «HTML to RTF .Net» SDK.
  • Follow to the "Solution Explorer" tab and add a reference to the "SautinSoft.HtmlToRtf.dll".
You will likely be surprised at the amount of built in functionality and ability to convert also to other formats:
How looks HtmlToRtf .Net class

Nuget  Online Demo   Download, (Feb 11-th, 2020)

Have a Question?

You have a question, need a support or a code example: ask our support team at We will help you quickly and with pleasure.

At the final point of this page we've prepared three various examples to extract Text from HTML.

Three examples to extract Text from HTML in C# and VB.Net

1. Simple extraction of Text from HTML file in C#:

            SautinSoft.HtmlToRtf h = new SautinSoft.HtmlToRtf();

            string htmlFile = @"d:\Resurrection.html";
            string textFile = Path.ChangeExtension(htmlFile, ".txt");

            h.OutputFormat = HtmlToRtf.eOutputFormat.TextUnicode;
            h.ConvertFile(htmlFile, textFile);
2. Convert HTML to Text in memory using C#:
            SautinSoft.HtmlToRtf h = new SautinSoft.HtmlToRtf();

            string htmlFile = @"d:\Resurrection.html";
            string htmlString = File.ReadAllText(htmlFile);

            // Start the conversion.
            h.OutputFormat = HtmlToRtf.eOutputFormat.TextAnsi;
            string textString = h.ConvertString(htmlString);
3. Extract Text from HTML in memory using VB.Net:
			Dim h As New SautinSoft.HtmlToRtf()

			Dim htmlFile As String = "d:\Resurrection.html"
			Dim htmlString As String = File.ReadAllText(htmlFile)

			' Start the conversion.
			h.OutputFormat = HtmlToRtf.eOutputFormat.TextUnicode
			Dim textString As String = h.ConvertString(htmlString)

If anyone needs a code sample in C#, VB.Net, ASP.Net etc "How to convert HTML to Text", email us at or ask at Online Chat (right-bottom corner of this page). We'll help you certainly!

Requirements and Technical Information

     Requires only .NET Framework 4.0 and up or .NET Core 2.0 and up. Our product is compatible with all .NET languages and supports all Operating Systems where .NET Framework and .NET Core can be used.
Note, that «HTML to RTF .Net» is entirely written in managed C#, which makes it absolutely standalone and an independent library.

.Net Framework 4.0 and higher and .Net Core 2.0 and higher

.NET Framework 4.0, 4.5, 4.6.1 and up.

.NET Standard 2.0

.NET Core 2.0 and up.

Multi-platform component, runs on:

Our component has proven itself on cloud platforms and services:

  • Microsoft Azure
  • Amazon Web Services (AWS)
  • Google Cloud Platform
  • SharePoint
  • Docker
  • etc.

Reasonable prices

     The library offers developers high quality conversion at reasonable prices. The main point of interest is that «HTML to RTF .Net» is less expensive than all of its more or less popular counterparts. For example, a single license cost $339(US) with no additional fees or royalties!


To see this functionality firsthand, download the freshest «HTML to RTF .Net» with code examples, 32.1 Mb.


  • Sweden, Stockholm
  • Mortviksvagen 68B 142 43 SKOGAS
  • Tel: +46 812111486
  • Email:
    Copyright © 2002 - 2020 SautinSoft (started from All rights reserved.