2026 Current
HTML and CSS optimization is essential to staying under 102KB. Most email templates have 30-50% bloat that can be eliminated without affecting design or functionality.
CSS Inlining: When and Why
CSS inlining converts style tags to inline styles. Many email clients strip style tags, so inlining is often necessary. However, inlining increases HTML size. Balance between embedded CSS for media queries and inlined CSS for client compatibility.
HTML Minification Strategies
Remove all whitespace, newlines, and indentation. Minified HTML can reduce file size by 30-40%. Use automated minifiers rather than manual editing.
Removing Classes and IDs
Remove unused class attributes and ID attributes. Email clients do not support CSS classes the same way web browsers do. Simplify markup and remove unnecessary attributes.
Removing HTML Comments
HTML comments add nothing to the final email. Remove all comment sections before sending. Comments inflate file size without any benefit.
Removing Unused CSS Rules
Strip CSS rules that are not applied to any element. Tools like UnCSS and PurgeCSS identify unused rules and remove them automatically.
File Size Targets: Under 102KB
Aim for templates under 75KB to leave room for dynamic content. Never exceed 102,005 bytes, which is Gmails clip limit. Measure total size of HTML and images combined.
Automation Tools and Minifiers
Use automated tools like MJML, Stripo, and Dyspatch which handle optimization during template export. Many ESPs offer auto-minification in their template builders.
Measuring Template Size
Use gzip-enabled byte counting tools to measure actual file size. Most email is transmitted gzipped, so measure gzipped size, not raw HTML size.