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 Check an Image’s Dimensions Before You Upload It
Check an image's width, height, and file size before uploading, avoid upscaling, and test it on your site.
Read article →How to Pick a Colour From an Image (Without Guessing)
Pick an exact colour from any image with an eyedropper, save the hex code, test contrast, and keep your palette small.
Read article →How to Find a Font From an Image (the Practical Way)
Identify a font from an image with a clean crop, compare candidates letter by letter, check licences, and test lookalikes.
Read article →