HTML encoder
Escape markup characters as HTML entities, or decode those entities back.
Docify's HTML tool escapes the five markup characters in your browser. Encode replaces & first, then <, >, ", and apostrophe as ' (not '). Decode expands those named entities plus decimal or hex numeric character references. Encode and Decode are buttons, not as-you-type. Not URL encoding, not a sanitizer, and not the full HTML named-entity table. Nothing is uploaded.
Plain text
Encoded output
How it works
- Encode and Decode are buttons, not as-you-type. Load sample fills the input only. Copy writes the output. Nothing is uploaded.
- Encode replaces
&with&first, then<→<,>→>,"→", and'→'. Other characters stay unchanged. - Decode expands
&,<,>,", and', plus well-formed&#decimal or&#xhex numeric character references viaString.fromCodePointfor Unicode scalars 1–0x10FFFF (surrogates and out-of-range values stay as written). - This is not
encodeURI, notinnerHTML, not a sanitizer, and not the full HTML named-entity list ( stays ).
FAQ
- Does this tool upload my text?
- No. Encode, decode, and copy run in your browser. The page does not send the text to a server.
- Which characters does Encode escape?
- Only the five markup-significant characters, and & is replaced first so a later pass cannot double-encode an entity. & becomes &, < becomes <, > becomes >, " becomes ", and ' becomes '. Other characters, including non-ASCII, stay as themselves. This is not URL encoding and not a sanitizer.
- Why is the apostrophe ' instead of '?
- ' is defined in XML and HTML5 but was not in HTML 4.01. Encode always writes the numeric reference ', which every HTML and XML parser accepts. Decode still accepts ', ', and '.
- What does Decode leave unchanged?
- Decode expands those five named entities and well-formed decimal or hex numeric character references (< or <) into Unicode scalars. It does not expand the rest of the HTML named-entity table, so and © stay as written. Malformed or out-of-range numeric references are left intact. This is not innerHTML, not a DOM parser, and not XSS protection.
Related
- Named vs numeric HTML entities
- Sibling tools: URL encoder and Base64 encoder