HTML encoding replaces special characters with HTML entities so they are treated as plain text instead of markup. This prevents broken layouts, avoids accidental tag parsing, and helps protect literal content such as code snippets, quotes, or user input. π‘οΈπ§©
What you can do
- Encode raw text or HTML so it can be safely displayed inside a page.
- Decode HTML entities back into human-readable characters.
- Preview & copy escaped output for use in templates, CMSs, or documentation.
How it works
- Encode escapes the five core HTML characters:
&β&,<β<,>β>,"β",'β'. Other characters are left untouched for readability. - Decode resolves named and numeric entities back into characters using the browser's HTML parser.
HTML entity quick reference
| Character | Entity | Why it matters |
|---|---|---|
& |
& |
Starts all entities |
< |
< |
Prevents tag injection |
> |
> |
Closes HTML tags |
" |
" |
Protects attribute values |
' |
' |
Useful in single-quoted attributes |
Buttons
- Encode Β»: Convert the left textarea into escaped HTML and show it on the right.
- Decode Β»: Convert entities on the left back to readable characters.
- Β« Swap Β»: Swap left/right fields to continue converting in the opposite direction.
- Copy Result π: Copy the right texarea to the clipboard.
- Erase: Clear both fields.
- Demo: Fill the input with a short example you can try immediately.
How to use
- Paste raw text (or HTML with entities) into the Input field.
- Click Encode to escape or Decode to unescape.
- Use Swap to move results back to the input for another round.
- Click Copy Result when you're ready to paste elsewhere.
Examples
- Input:
<div class="greet">Tom & Jerry</div>
Encode β<div class="greet">Tom & Jerry</div> - Input:
<span>5 & 7</span>
Decode β<span>5 & 7</span>
Tips & best practices
- Always escape user-generated content before inserting it into HTML to avoid XSS issues β οΈ
- Escape text differently for HTML, attributes, and JavaScript contexts.
- Escaping the core five characters is enough for most HTML pages.
Notes & limitations
- This tool is intended for HTML. XML and other markup languages may require a broader escape set.
- Decoding relies on the browser's parser and supports both named and numeric entities.
- Double-encoding will produce nested entities (which is sometimes intentional).


