HTML Entity Encoder

Convert special characters to HTML entities for safe display in web pages

About HTML Entity Encoder

Overview

The HTML Entity Encoder changes special characters in your text into HTML entities. This is important for showing text safely on websites, stopping HTML injection, and making sure special characters look right in all browsers. The tool can make named entities (<), decimal entities (<), and hexadecimal entities (<).

Features

  • Three entity types: Named (<), Decimal (<), and Hexadecimal (<).
  • Flexible encode modes: Essential, Essential + Non-ASCII, or All.
  • Supports over 40 character encodings.
  • Lets you upload files up to 100MB.
  • Encodes in real time as you type.
  • Keeps the structure of your text.
  • One-click copy to clipboard.
  • Lets you download the result as a text file.
  • Swap input and output easily.
  • All work is done in your browser to keep your data private.
  • Has a dark mode for easier viewing.

How to Use

  1. Paste your text in the input box, or upload a file.
  2. Pick the entity type you want. Named entities are easier to read, while numeric ones work for more characters.
  3. Choose the encode mode. "Essential Only" covers the five main HTML characters. "Essential + Non-ASCII" adds international characters. "All Special Characters" encodes everything possible.
  4. If your text has a special character encoding, choose it from the list. UTF-8 is a good choice for most cases.
  5. The tool encodes your text in real time as you type.
  6. Use the "Copy" button to save the result, or "Download" to get it as a file.
  7. The "Swap" button lets you switch the input and output.

FAQ

Why do I need to encode HTML entities?

You need to encode HTML entities to stop the browser from reading special characters as HTML code. For example, to show the text `<p>`, you have to encode the `<` and `>` as `&lt;` and `&gt;`. If you do not, the browser will think it is an HTML tag and not show it.

Which entity type should I use?

Named entities (`&lt;`) are easy for people to read. Decimal (`&#60;`) and hexadecimal (`&#x3C;`) entities work for any Unicode character, which is good for special symbols that do not have a named entity.

What is the "Essential Only" encode mode for?

This mode is for security and basic HTML use. It encodes the five characters (`&`, `<`, `>`, `"`, `'`) that have a special meaning in HTML and could be used for XSS attacks. This is the least you should encode when showing user content on a website.