Free HTML Encoder & Decoder Online
Encode special characters to HTML entities (&, <, >, ") or decode them back — instantly in your browser.
How it works
Paste your text
Enter the string containing characters you want to HTML-encode (or HTML entities to decode).
Encode or Decode
Click Encode to convert < > & " to entities, or Decode to reverse it.
Copy the result
Copy the encoded/decoded output to use in your HTML, template, or code.
All in the browser
Uses a textarea trick — a native browser technique. Zero server calls.
Common use cases
Preventing XSS
Before rendering user-supplied strings as HTML, encode them to prevent cross-site scripting attacks. < becomes < and > becomes >.
Displaying code in HTML
Encode HTML snippets before wrapping them in <pre><code> blocks so the browser renders them as text instead of parsing the tags.
Email template content
HTML emails often require entities for characters like ampersands, quotes, and angle brackets to render correctly across email clients.
Decoding received data
API responses or scraped data sometimes contain HTML entities. Decode them to get the plain-text values.
Frequently asked questions
What are HTML entities?
HTML entities are escape sequences for characters that have special meaning in HTML. For example, < is <, > is >, & is &, and " is ".
When should I HTML-encode?
Always encode user-supplied data before rendering it as HTML content. This is one of the primary defenses against cross-site scripting (XSS) attacks.
What is the difference between HTML encoding and URL encoding?
HTML encoding escapes characters for HTML context (&). URL encoding escapes characters for URL context (%26). Use HTML encoding for content inside HTML pages; URL encoding for URL parameters.
Does this handle all Unicode characters?
The encoder converts the five critical HTML characters (< > & " '). For extended characters, use the numeric entity form (e.g., © for ©).