HTML Encoder
This page opens Encode: type in the Text box and read the escaped result in Entities. Named and Numeric cover markup characters and non-ASCII text; Markup only escapes the five markup characters while retaining accents and emoji. The result stays text and can be copied into a suitable HTML text or attribute context.
- Direction
- Entities
- 7
- Length
- 50
- Policy
Encoding with names: the five markup characters and everything outside plain ASCII are written as references, using the HTML name where there is one and a number where there is not. Every other character is left as it was.
Worked examples
Type in either box: editing the entities side decodes, editing the text side encodes. Swap sends the text you have to the other box, which is the fix for a paste that went in the wrong one. Positions count characters from the start of the box, beginning at 1, and an emoji counts as one character.
Common questions
- Which encoding policy should I choose?
- Named writes the known name where available and decimal references otherwise. Numeric writes decimal references for the same covered characters. Markup only escapes ampersand, less-than, greater-than and both quotes, leaving other Unicode text unchanged. None of the policies is a complete JavaScript, CSS, URL or JSON escaping function.
- Does the preset replace my remembered direction or policy?
- It opens Encode while retaining your remembered policy. Editing text alone does not replace a direction supplied by the preset in saved settings. Selecting Encode or Decode, including the current control, explicitly saves that choice. Selecting a policy saves that policy.
- Can I use this to encode an email address or hexadecimal entities?
- The text can be written as references, but that is not email delivery validation or spam protection. Numeric output is decimal; hexadecimal references can be decoded and looked up in the parent chart, but there is no hexadecimal-output option.
Decoding is done by an inert parser that never runs the markup, and the result is always text rather than something the page renders. Encoding covers the characters you choose, and every other character is left exactly as it was.