HTML Encoder & Decoder

The best HTML Decoder Online. Safely escape special characters, decode links, and get snippets for C# and JavaScript.

⚠️ Looking for %20 or %2F?

If you are trying to html encode 20 (space) or html decode 2f (slash), you are likely looking for URL Encoding, not HTML.Use our URL Encoder here.

HTML Encoding & Decoding Guide

HTML Encode in C#

Developers frequently search for html encode c#. The most common way to handle special characters in .NET applications is:

string raw = "<script>";
// Using System.Web
string encoded = HttpUtility.HtmlEncode(raw);
// Output: &lt;script&gt;

HTML Decode in JavaScript

If you need to html decode javascript strings effectively without a library:

function decodeHtml(html) {
  var txt = document.createElement("textarea");
  txt.innerHTML = html;
  return txt.value;
}

HTML Encode Space & Links

HTML Encode Space: In HTML, multiple spaces are collapsed. To force a space, use the entity &nbsp; (Non-Breaking Space).

HTML Decode Link: Sometimes URLs inside HTML attributes get encoded (e.g., &amp; inside a query string). A HTML Decoder converts these back to valid URL characters so the link works.

Common HTML Encoded Characters

  • <&lt;
  • >&gt;
  • &&amp;
  • "&quot;
  • '&#39;
  • Space → &nbsp;

Quick Examples