HTML Encoder/Decoder
Workspace
What is the HTML Encoder/Decoder?
The HTML Encoder/Decoder converts characters that have special meaning in HTML into safe HTML entities, and converts entities back again. For example, it turns < into <, > into >, & into &, and " into ". Encoding lets you display code, user input, or special characters on a page without the browser treating them as markup.
How to Use the HTML Encoder/Decoder
- Open the HTML Encoder/Decoder page.
- Choose Encode or Decode in the Mode dropdown.
- Paste your text into the Input box.
- Click Process to convert it.
- Click Copy to copy the result, or switch the mode and run it again to reverse the conversion.
Worked Example
Observed run in Encode mode: input <p>Tom & Jerry "5 > 3"</p> returned <p>Tom & Jerry "5 > 3"</p>. Each special character was replaced by its named entity, so the whole snippet can be shown as visible text instead of being parsed as an HTML paragraph. Decoding that output returns the original snippet.
Limitations
- The tool encodes the characters it is designed for, mainly
<,>,&, and". Do not assume every Unicode character gets a named entity. - Encoding does not by itself make untrusted input safe for every context. Attributes, JavaScript, and URLs need their own escaping rules.
- Decoding twice can change text that already contains literal entity text, such as
&lt;. Decode only once unless you mean to unwrap two layers. - There is no option observed for choosing named versus numeric entities, so the output format is fixed.
- Very long inputs are handled in the browser, but pasting extremely large documents can be slow.
Frequently Asked Questions
Why encode HTML at all?
So the browser shows the characters instead of interpreting them. Without encoding, <p> in a tutorial would create a real paragraph instead of showing the code.
What is the difference between Encode and Decode?
Encode turns characters into entities, such as < into <. Decode turns entities back into characters.
Does encoding prevent cross-site scripting?
It helps when displaying text in HTML content, but it is not a complete security fix. Use a proper escaping library and follow your framework security guidance for user input.
Can I round-trip text through Encode then Decode?
Yes. Encoding then decoding the example above returns the original snippet exactly, as observed in testing.
Related Tools
From the Blog
How to Merge PDF Files Into One Document (Without Losing Pages)
You have five PDFs. Your bank wants one file. Your university wants one file. Your client wants one file. Merging them is…
Read article →How to Recover a Hacked Account and Lock It Down Again
Losing an account feels personal. Your email holds your photos, your receipts, and the password-reset links for almost everything else you own…
Read article →What Are Passkeys and How to Set One Up on Your Google and Apple Accounts
A password is a secret you have to remember, type, and keep out of other people’s hands — and it fails at…
Read article →