HTML Encoder/Decoder
Encode special characters to HTML entities or decode entities back to text. Prevents XSS attacks and displays HTML correctly.
0 bytes
0 bytes0 entities
Encodes special HTML characters (&, <, >, ", ') to their entity equivalents. Decoding supports named entities (&), decimal (&), and hex (&) formats.
How to Use This Tool
- 1
Choose encode or decode mode
Select 'Encode' to convert special characters to HTML entities, or 'Decode' to convert entities back to readable text.
- 2
Enter your text
Paste or type your content in the input area. The output updates instantly as you type.
- 3
Use swap for quick conversion
Click 'Swap' to move the output to input and toggle the mode — useful for round-trip testing.
- 4
Copy the result
Click 'Copy' to copy the encoded or decoded text to your clipboard for use in HTML, emails, or code.
Frequently Asked Questions
- Why do I need to encode HTML?
- HTML encoding prevents XSS (cross-site scripting) attacks and ensures special characters display correctly. Without encoding, a < character might be interpreted as the start of an HTML tag.
- What characters are encoded?
- The main characters encoded are: & (ampersand), < (less than), > (greater than), " (double quote), ' (single quote), and / (forward slash).
- What entity formats are supported for decoding?
- The decoder supports named entities (&, <), decimal entities (&, <), and hexadecimal entities (&, <). Common HTML5 entities like are also supported.
- Is this the same as URL encoding?
- No. HTML encoding uses entities like & for display in HTML documents. URL encoding uses percent signs like %26 for safe use in URLs. Use our URL Encoder/Decoder for URL encoding.