EvoPdf Next · HTML to Markdown

Convert web pages and HTML to Markdown from .NET

The HTML to Markdown Converter loads a web page or an HTML string with its CSS and JavaScript, the same way the HTML to PDF Converter does, then writes the content as Markdown text with headings, lists, tables, code blocks, links and images. The result is easy to store, to index and to pass to AI tools. The library targets .NET Standard 2.0 and runs on Windows, Linux and macOS, including Azure App Service, Azure Functions and Docker.

Version 15.1.0. Building EVO PDF libraries since 2010. Evaluate without registration; the demo output is watermarked until you set a license key. Part of the HTML to PDF Converter component.

Documentation · Samples and demos on GitHub · AI agent skills

ConsoleCLI
dotnet add package EvoPdf.Next.HtmlToPdf.Windows

This is the Windows package; EvoPdf.Next.HtmlToPdf.Linux and EvoPdf.Next.HtmlToPdf.MacOS work the same way, or use the all-components EvoPdf.Next.* metapackage for your platform. This component ships in the HTML to PDF Converter package.

Program.csC#
using EvoPdf.Next;

var converter = new HtmlToMarkdownConverter();

// a web page given by its URL
string markdown = converter.ConvertUrl(
    "https://www.example.com");

// or an HTML string with a base URL
string fromHtml = converter.ConvertHtml(
    htmlString, "https://www.example.com/");
Convert a web page or an HTML string. Full sample in the docs →
  • Windows 10, 11 and Windows Server 2016 to 2025 (x64 and ARM64)
  • Linux 64-bit distributions (x64 and ARM64)
  • macOS 12.0+ (Apple Silicon / ARM64)
  • .NET 11.0, 10.0, 9.0, 8.0, 7.0, 6.0, .NET Standard 2.0
  • .NET Framework 4.6.2 to 4.8.1
  • Azure App Service, Functions and Container Apps
  • AWS Elastic Beanstalk, Lambda and ECS
  • Google Cloud Run and Kubernetes
  • Web, console and desktop applications
Options

Choose what goes into the Markdown

Navigation bars, footers and banners are rarely wanted in the result. A CSS selector picks the part of the page to convert and another one leaves elements out. The images can be written as links, with the source they have in the page, embedded in the text or left out.

Pages that fill their content from JavaScript are converted after a delay or after an element given by a CSS selector is present. Convert HTML to Markdown: documentation →

Options.csC#
using EvoPdf.Next;

var converter = new HtmlToMarkdownConverter();

// only the article, without its side notes
converter.ConvertedElementsSelector = "article";
converter.ExcludedElementsSelector = "aside, nav";

// embed the images and wait for the content
converter.ImageMode = MarkdownImageMode.Embed;
converter.WaitForSelector = "#content-loaded";

string markdown = converter.ConvertUrl(url);
Features

What the HTML to Markdown component does

  • Convert a web page from a URL or an HTML string to Markdown
  • Return the Markdown as a string or write it to a file
  • Headings, paragraphs, lists, tables, code blocks and quotes
  • Links written as Markdown links, or only their text
  • Images written as links, left out or embedded in the text
  • Convert only a part of the page selected with a CSS selector
  • Leave elements out of the result with a CSS selector
  • Wait for a delay or for an element before the conversion starts
  • Images that load lazily are loaded before the conversion
  • Asynchronous methods that can be used with async and await

NuGet packages

Reference EvoPdf.Next.HtmlToPdf.Windows, .Linux, .MacOS or the .Arm64 variants, or the EvoPdf.Next.* metapackage for your platform, which includes every component.

ConsoleCLI
dotnet add package EvoPdf.Next.HtmlToPdf.Windows

On nuget.org: EvoPdf.Next.HtmlToPdf.Windows · .Linux · .MacOS · .Windows.Arm64 · .Linux.Arm64 · metapackage EvoPdf.Next

HTML to Markdown is part of the EvoPdf Next HTML to PDF Converter (EvoPdf.Next.HtmlToPdf packages), together with HTML to PDF and HTML to Image.
HTML to MarkdownDemoDocs + code
Licensing

Covered by the HTML to PDF license

HTML to Markdown is part of the HTML to PDF Converter component and uses its license. The EVO PDF Toolkit license covers it too, together with every other component on this site, Next and Classic.