HTML Entity Encoder & Decoder is a free tool that escapes text so it can be shown safely inside HTML, and turns HTML entities back into normal characters. Encoding changes < into <so browsers display it instead of treating it as a tag. Everything runs in your browser.
How to use it
- Choose Encode to escape text or code, or Decode to turn entities back into characters.
- Paste your text; the result appears on the right.
- Switching direction moves the current result into the input, so you can check it round-trips.
What gets encoded
&→&<→<and>→>"→"and'→'
With the extra option, every non-ASCII character is also encoded as a numeric entity, soé becomes é. That is only needed for old systems that can’t store UTF-8.
Why escaping matters for security
If text typed by a user is inserted into a web page without escaping, someone can type HTML or a<script> tag and have it run in other visitors’ browsers. This is called cross-site scripting (XSS). Escaping the five special characters prevents it. Modern frameworks do this automatically, but it still matters for templates, emails and hand-written HTML.
Decoding safely
Decoding supports every named entity in the HTML standard, such as ©,é and , as well as numeric ones like 😀. Tags in the input are left as text and never run.
Entities are one of several web encodings. For text inside a link or query string, useURL Encode instead; to write formatted content without HTML at all, try theMarkdown Previewer.
Frequently asked questions
When do I need to escape HTML?
Whenever text should appear literally on a web page rather than be treated as markup, for example when showing code samples, or displaying text typed by users. Escaping user input is an important defence against cross-site scripting (XSS).
Which characters are escaped?
The five with special meaning in HTML: & < > " and '. Optionally, every non-ASCII character too, for old systems that cannot handle UTF-8.
Which entities can be decoded?
All of them: named ones such as © and é, and numeric ones such as © and 😀.
Last updated