Show the text <b> on a web page and the browser tries to make something bold. To display it literally, you write it as an entity.
What the tool encodes
The HTML Entity Encoder/Decoder replaces the five characters that break HTML. The input <a href="x">Tom & Jerry's</a> becomes:
<a href="x">Tom & Jerry's</a>
The five replacements are: & to &, < to <, > to >, a double quote to " and a single quote to '.
What it decodes
Decoding turns those five entities back, and also converts numeric entities in decimal or hex form. © becomes the copyright symbol. Other named entities, such as © or , are left exactly as they are, because the tool does not carry a table of names. If you need those, replace them by hand or use the numeric form (© for the copyright sign).
Using the tool
- Choose encode or decode.
- Paste your text.
- Copy the result.
When to encode
- Showing code samples on a page.
- Putting user-supplied text into an HTML attribute.
- Writing an ampersand in an HTML or XML file.
Encoding is a basic safeguard but not complete security. Websites that accept user input must use the escaping built into their templating system, applied in the right place.
Frequently asked questions
Do I need to encode accented letters or emoji?
Not if the page is served as UTF-8, which is the norm. They can be written as they are.
Why did &amp; appear?
Text that was already encoded was encoded a second time. Decode it once, then encode only the plain version.