Use Cases
- Sanitizing user input before displaying it in HTML pages
- Encoding special characters like
<,>,&,", and'for safe HTML rendering - Decoding HTML entities from scraped web content or API responses
- Preparing text for XML/HTML attributes where special characters must be escaped
- Debugging HTML source code by decoding entity-encoded content
How It Works
Encode Mode (Default)
Converts these special characters to HTML entities:&→&<→<>→>"→"'→'
Decode Mode
Converts HTML entities back to their original characters in reverse order.The decoder handles the five most common HTML entities. For comprehensive entity support including named entities like
, ©, etc., use a dedicated HTML parser.Input Format
Encode: Plain text with special charactersOutput Format
Encode Output:Examples
Technical Details
Located in
lib/tools/engine.ts:466-467- Encode: Replaces special characters in a specific order (& first, then < > ” ’)
- Decode: Reverses the process in the correct order (& last to avoid double-decoding)
Performance
- Synchronous processing: All operations run client-side with no network calls
- No regex overhead: Uses simple string replacements for maximum speed
- Memory efficient: Works with strings up to 5MB
Related Tools
- Backslash Escape/Unescape - Escape special characters with backslashes
- URL Encode/Decode - URL-safe encoding
- HTML Beautify/Minify - Format HTML content