If you paste a code sample into a web page, the browser treats every < as the start of a tag and the sample vanishes or breaks the layout. Escaping replaces the handful of characters that have a meaning in HTML with entities, so they are displayed and not interpreted. The reverse is needed when exported text is littered with things like & and '.
Steps
- Open HTML entity encoder.
- Choose Encode to escape, or Decode to turn entities back into characters.
- Paste the text and copy the result.
What Encode changes
Exactly five characters, and nothing else:
- & becomes &
- < becomes <
- > becomes >
- the double quote becomes "
- the single quote becomes '
So <b>Tom & Jerry</b> turns into <b>Tom & Jerry</b>. Accented letters and emoji are left as they are, which is correct for a page saved as UTF-8.
Encoding text that is already encoded escapes it a second time: & becomes &amp;. If a page shows a visible & where an ampersand should be, the text was escaped twice somewhere. Run Decode once to repair it.
What Decode understands
- All numeric entities, decimal and hexadecimal: © and © both become the copyright sign.
- A short list of named entities: amp, lt, gt, quot, apos, nbsp, copy, reg, euro, hellip, ndash, mdash, laquo, raquo and trade.
Any other named entity, for example é, is left in the text unchanged. That is a real limit of this tool: it does not carry the full HTML entity table. Note also that becomes a non-breaking space, which looks like an ordinary space but is a different character.
Escaping and security
These five replacements are what makes text safe between tags and inside a quoted attribute value. They are not sufficient inside a script block, a style block or a URL. Text destined for a link address needs percent-encoding, which URL encoder / decoder does.
To swap one specific piece of text everywhere, use Find and replace.