Mini HTML Minifier
Golfed by xem
Found a bug? Want a new feature? open an issue
Nothing to minify? Try it with my test file or Apple.com's homepage!
Simple compression (120 bytes)
- Removes unnecessary whitespaces
- Removes trailing spaces and slashes in tags
- Removes unnecessary closing tags
- Doesn't remove HTML comments because they can be used by templating engines
<textarea oninput='for(i=9;i--;)value=value.replace(/<\/[tl].>\s*|[\s/]*(^|$|>)\s*|(\s)\s|<\/p>\s*(?=<p>|$)/gi,"$1$2")'>
More compression (128 bytes)
- Removes unnecessary whitespaces
- Removes trailing spaces and slashes in tags
- Removes unnecessary closing tags
- Remove HTML comments
<textarea oninput='for(i=9;i--;)value=value.replace(/<!.*?->|<\/[tl].>\s*|[\s/]*(^|$|>)\s*|(\s)\s|<\/p>\s*(?=<p>|$)/gi,"$1$2")'>