A simple, elegant web tool for converting text to HTML entities and back. Perfect for email obfuscation, privacy protection, and safely displaying special characters.
- Encode Text to Entities: Convert any text into numeric HTML entities (e.g.,
A→A) - Decode Entities to Text: Convert entity codes back to readable text
- Paste Buttons: Quick paste from clipboard for seamless workflow
- One-Click Copy: Easy clipboard functionality for output
- Bilingual Interface: Available in German and English
- Dark/Light Mode: Toggle between themes with persistent preference
- Clean Interface: Minimal, distraction-free design
- Mobile Responsive: Works seamlessly on all devices
- Accessibility: WCAG AA compliant contrast ratios
- No Dependencies: Pure vanilla JavaScript
Protect email addresses from spam bots by converting them to entities:
<!-- Instead of -->
<a href="mailto:info@example.com">info@example.com</a>
<!-- Use -->
<a href="mailto:info@example.com">
info@example.com
</a>Hide phone numbers from crawlers while keeping them visible to users.
Obfuscate required contact information on privacy policies and legal notices.
Safely embed Unicode and special characters regardless of file encoding.
Simply visit the live demo
No installation. No cookies. No tracking. Everything runs locally in your browser.
- Clone the repository:
git clone https://github.com/dontdevpanic/html-entity-encoder.git
cd html-entity-encoder- Open
index.htmlin your browser - that's it!
No build process, no dependencies, no complications.
html-entity-encoder/
├── index.html # Main HTML structure (German)
├── index-en.html # English version
├── style.css # Styles with dark/light mode
├── script.js # Encode/decode functionality
├── favicon.svg # Site favicon
├── info.svg # Info icon
├── danger.svg # Warning icon
├── LICENSE # MIT License
├── README.md # You are here!
└── README-de.md # German Version
The encoder uses JavaScript's charCodeAt() method to convert each character to its Unicode code point:
function encodeText(str) {
let encoded = '';
for (let i = 0; i < str.length; i++) {
encoded += '&#' + str.charCodeAt(i) + ';';
}
return encoded;
}The decoder uses a regular expression and String.fromCharCode() to convert entities back:
function decodeEntities(str) {
return str.replace(/&#(\d+);/g, (match, dec) => {
return String.fromCharCode(dec);
});
}- This is obfuscation, not encryption! The text isn't secret - browsers automatically convert entities back to readable text.
- Limited protection: Only works against simple bots that scan for specific patterns.
- Not for security: Don't rely on this for protecting truly sensitive data. Use proper security measures instead.
Modify CSS variables in style.css:
:root {
--accent-primary: #0056b3; /* Primary accent color */
--bg-primary: #ffffff; /* Light mode background */
}
[data-theme="dark"] {
--bg-primary: #1a1a1a; /* Dark mode background */
--accent-button: #1e6cd2; /* Dark mode accent */
}Change the font stack in style.css:
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', ...;
}Contributions are welcome! Feel free to:
- Report bugs
- Suggest new features
- Submit pull requests
- Improve documentation
This project is open source and available under the MIT License.
- Created with 🖤 by Bianca | DontDevPanic
- Part of the DevPanicZone learning project
- This tool was developed with AI assistance
Check out other tools from DontDevPanic:
- HTML Code Escaper - Display HTML code on websites
Have questions or suggestions? Feel free to open an issue on GitHub!
Star this repo if you find it useful!
