What the HTML Entity Encoder / Decoder does
This page converts reserved characters in a block of text into HTML entities, and converts entities back into the characters they stand for. Encoding turns the ampersand, the less-than sign and the greater-than sign into &, < and >, which is what makes a code sample display as readable text instead of being parsed as markup. Decoding walks the same path in reverse.
The box loads with a sample line that shows a div tag, a copyright entity and escaped brackets. Press the encode button and that line becomes literal entity text, ready to paste into a documentation page where the tag has to appear as words on screen. Paste an entity back in and press decode, and the copyright symbol returns as a character while the surrounding tags are read as markup.
How to use it
- Paste your textDrop the markup or the entity string into the single input box. It starts with a small sample so you can test both directions before you commit your own content to it.
- Press encode or decodeEncode escapes the characters HTML reserves, so the result displays as written. Decode resolves named and numeric entities such as & or © back into the symbols they represent.
- Read the output boxThe converted string appears under the buttons and can be selected and copied as ordinary text. The counter beneath it reports the length after conversion, which grows during an encode pass and shrinks during a decode.
- Clear between jobsEmpty both boxes before pasting the next string. The page holds no history, and the previous result is replaced the moment you run the tool again, so copy anything you want to keep first.
Options and formats
Things to watch out for
Frequently asked questions
Why does my HTML show up as text instead of rendering?
The tags were encoded somewhere along the way. Once angle brackets become < and >, the browser treats them as characters to print rather than markup to build. Decode the string if you wanted live HTML, or keep it encoded when the point is to show the code to a reader.
Can I use this to protect against XSS?
It covers one step only. Escaping user text before placing it in HTML is correct, but safety also depends on where the text lands. Values inside attributes, inside URLs and inside script blocks each need their own escaping rules, and this page has no context-aware mode.
Which characters does the encoder turn into entities?
The ampersand, the less-than sign, the greater-than sign and non-breaking spaces. Accented letters, currency signs, copyright marks and emoji stay as ordinary characters, so a string containing a copyright symbol keeps that symbol rather than an entity written out in text.
What is the difference between & and &amp;?
The second one has been escaped twice. & is the entity for an ampersand and renders as a single character, while &amp; renders as the visible characters of the entity itself. If your page shows entity text instead of a symbol, run one decode pass over it.
Does it understand numeric character references?
Yes, decoding resolves both decimal and hexadecimal references into their characters. Encoding never writes numeric references, so a decode followed by an encode does not reproduce the original string character for character. Keep the source text if you need an exact round trip.
Is there a size limit on the input?
The page enforces none, but everything runs in a single browser tab, so a very long document will slow the tab down and may stall the parser. For bulk work, split the text into chunks or move the escaping step into your build script instead.