Skip to content

Encoding

HTML Encoder & Decoder

Encode special characters as HTML entities or decode them back to text.

How to use this tool
  1. Paste text or open a UTF-8 text or HTML file, then choose Encode HTML or Decode HTML.
  2. Run the conversion and inspect the plain-text output. Imported HTML is never rendered as a page.
  3. Copy the result, download a text file or use the output as input for a reverse conversion.

Loading tool…

Find this tool in

Helpful references

About this tool

What is HTML Encoder & Decoder?

Represent text containing HTML-significant characters without letting those characters become markup. Encoding is useful when showing source inside a document; decoding makes entity-encoded text readable again. Choose the operation for the actual context, because HTML text, HTML attributes, JavaScript and URLs have different escaping requirements.

A worked example

Display an HTML fragment as text

Example input

<b>A & B</b>

Expected result

&lt;b&gt;A &amp; B&lt;/b&gt;

Encode the sample to protect the angle brackets and ampersand. A browser reading that encoded text in an HTML text context displays the fragment rather than making it bold. Decoding reverses the representation. If you insert the decoded result as HTML elsewhere, its markup becomes active again, so inspect the destination's rendering behavior.

Common mistakes and limits

  • Entity encoding is not a universal sanitizer. Use the escaping or safe DOM API appropriate to the context where untrusted content will be inserted.
  • Encoding an already encoded value can produce visible double escapes such as &amp;lt;. Establish which processing stage owns the encoding.

Features

What you can do

  • Encode special characters into HTML entities.
  • Decode named and numeric HTML entities.
  • Support international text and Unicode characters.
  • Swap input and output for quick round trips.
  • Copy encoded or decoded output instantly.
  • Process all content locally without executing markup.
  • Open UTF-8 text or HTML files and download results as plain text.

Frequently asked questions

Questions about HTML Encoder & Decoder

Can I encode or decode a local HTML file?

Yes. Open a UTF-8 .txt, .html or .htm file up to 4 MiB and 1,000,000 characters. Choose a conversion and download the result as a .txt file. The source is read as text and stays in your browser.

Why should HTML text be encoded?

Encoding prevents characters such as angle brackets and ampersands from being interpreted as HTML markup when they should be displayed as plain text.

Does HTML encoding provide security?

Context-aware output encoding is an important defense against cross-site scripting, but correct protection depends on where the value is inserted. HTML text, attributes, URLs and JavaScript require different handling.

Are numeric HTML entities supported?

Yes. The decoder supports decimal entities such as &#169; and hexadecimal entities such as &#x1F680; through the browser HTML parser.

Does this tool execute the HTML I enter?

No. The input is treated as text and is never rendered as active HTML.

Related tools