DEV
🔐 Encoding
HTML Encoder / Decoder
HTML encoding converts special characters into their corresponding HTML entities. This is critical for preventing Cross-Site Scripting (XSS) attacks by ensuring user input is rendered as text rather than executed as markup.
How to Use
- Select Encode to convert HTML characters to entities, or Decode to convert entities back.
- Paste your HTML or text into the input panel.
- Click Transform to encode or decode.
- Encoded output is safe to embed in HTML without risk of script execution.
How It Works
The tool uses the browser's DOM API:
innerText → innerHTML for encoding (HTML entities are inserted), and innerHTML → innerText for decoding (entities are resolved). This handles all standard entities: & < > " ' and their numeric equivalents.