HTML Email Coding Tips
How to write email HTML that holds up in Outlook desktop, Gmail and phone mail apps, which build tools reduce the manual work, and what each one costs.
For most teams that write email HTML from scratch, MJML is the best starting point. You write components such as sections, columns and buttons, and it compiles them into responsive, table-based markup that Outlook and webmail clients can display. It is self-hosted, so there is no subscription fee: the cost is the time to set up a build step on your own machine or server. Check the current terms on the MJML pricing page.
Why Email HTML Is Its Own Discipline
Email clients do not share a rendering engine. Outlook for Windows uses Microsoft Word's engine, which ignores many modern CSS properties and handles spacing, background images and image sizing its own way. Gmail strips or rewrites parts of the document head, so styles placed there can disappear. Apple Mail and iOS are more permissive, and Android clients differ again. A template that looks right in a desktop browser can still break in the inbox, which is why email coding is mostly a matter of choosing a conservative subset of HTML and CSS and testing the compiled output.
The practical rules follow from that. Lay out the message with tables, not flexbox or grid. Put the styles that matter directly on each element. Give every image explicit dimensions. Treat dark mode and images-off viewing as normal states, not edge cases. The rest of this guide covers how to apply those rules by hand, and when a build tool or a rendering service saves enough time to justify its cost.
Choosing Your Build Path
There are three realistic ways to produce email HTML: write it by hand, compile it from a component library, or write it with a utility-class framework and compile that. A rendering service sits alongside any of them and checks the result. The table below compares the tools that matter for this decision. Prices are the ones published on each vendor's pricing page, checked on 7 October 2026.
| Tool | Best for | Starting price (plan and billing) | Key limitation |
|---|---|---|---|
| Hand-coded tables | One-off, simple messages written by a developer | No software cost | Every template repeats the same Outlook fixes, and drift grows over time |
| MJML | Teams that want responsive markup without writing table code | Self-hosted; no subscription listed | You run the build yourself; compiled output is longer than the source |
| Maizzle | Teams already fluent in Tailwind CSS | Self-hosted; no subscription listed | Assumes Tailwind knowledge and a Node-based build setup |
| Email on Acid | Checking how a finished template renders across clients | Basic at $99/month, billed monthly, 1,000 previews a month | It checks output; it does not write or fix your code |
| Clari | Not an email template tool; a revenue platform for sales teams | Custom pricing, no public plan price | Outside the scope of HTML coding |
| Convert | Experiments and A/B tests on web pages | Growth at $399/month, or $299/month billed annually | Does not build or preview email HTML; 15-day trial only, no free plan |
Clari and Convert are included so you can rule them out quickly. Neither produces email markup, so they do not belong in an email coding stack.
MJML: Components That Compile to Safe Markup
What it does well for this audience. MJML suits a team that needs many similar messages, such as welcome series, receipts and newsletters, built from the same parts. You write a header, a hero, a column of text and a button as components, and the compiler generates the nested tables, the mobile breakpoints and the Outlook-specific wrappers. Developers can read the source quickly, and designers can work from a predictable set of blocks. Because the output is generated, a fix to one component reaches every template that uses it.
Where it falls short. The compiled HTML is verbose, so the file you send is much larger than the source you wrote. Debugging means reading the output, and you will still need a rendering check, because the compiler cannot guarantee how every client treats a custom style you add. It also asks for a build step: someone has to run it, and the output has to be committed or deployed somewhere.
Price. MJML is self-hosted. There is no subscription listed on its pricing page to budget for, so your cost is developer time and the infrastructure that runs the build. Source: mjml.io/pricing.
Maizzle: Tailwind-Style Classes for Email
What it does well for this audience. Maizzle lets a team that already thinks in utility classes write email layouts with the same vocabulary it uses for web interfaces. Classes are compiled into inline styles, which avoids the head-styles problem described above. Teams that maintain a shared design system can reuse their spacing and colour tokens in the email build, so the emails look consistent with the product.
Where it falls short. If nobody on the team knows Tailwind, the learning curve is real, and the class names can make a template harder to read for someone who only writes HTML. The setup is also a Node project with its own configuration, so it fits teams that are comfortable running a build pipeline, and it is a poor fit for a single marketer editing one template.
Price. Maizzle is self-hosted, with no subscription listed. Your costs are the developer time to configure it and the hosting or CI runs that build the templates. Source: maizzle.com/pricing.
Email on Acid: Rendering Checks, Not Code
What it does well for this audience. Email on Acid is useful once you have a finished template and need to see how it appears across many clients and devices. Both paid plans list over 100 preview clients and devices. The Premium plan adds accessibility tests and HTML analysis, which help catch problems that a visual preview will not show, such as missing alt text or unclear structure. The Basic plan includes API access, so previews can be triggered from a CI job rather than by hand.
Where it falls short. It shows you what is broken but does not fix it, so someone still needs to change the code. Preview volume is the cost driver, which means a busy team that re-checks every edit can run out of previews in a month. There is also no free plan listed on the pricing page.
Price. Basic is $99 per month and includes 1,000 email previews a month. Premium is $199 per month and includes 2,000 previews a month. Both are monthly subscriptions listed on the Email on Acid pricing page.
What Rendering Checks Cost at Three Volumes
Because Email on Acid charges by preview volume, the useful question is how many previews your team will run each month. The table below uses three realistic scenarios and shows only prices that are listed on the vendor's pricing page. Where a volume is above the highest listed plan, the price is shown as pricing on request.
| Scenario | Previews needed per month | Plan that covers it | Monthly price | Twelve months |
|---|---|---|---|---|
| Small team, a few templates, occasional changes | About 500 | Basic (1,000 previews) | $99 | 12 × $99 = $1,188 a year |
| Growing team, weekly campaigns, frequent edits | About 1,500 | Premium (2,000 previews); Basic is too small | $199 | 12 × $199 = $2,388 a year |
| High-volume team, many templates and locales | About 2,500 or more | Above the listed Premium allowance | Pricing on request | Pricing on request |
The hand-coded, MJML and Maizzle options have no listed subscription. Their real cost is the hours your developers spend writing and maintaining the build, and the server or CI minutes that run it. Include those hours in any comparison before you decide that a rendering subscription is the expensive option.
Copyable Building Blocks
The two snippets below are the foundations most hand-coded templates need. Both use table markup, inline styles and the role="presentation" attribute so screen readers do not read the layout as data.
A bulletproof button. The link is styled inside a table cell, so the button still shows as a coloured block when images are blocked.
<table role="presentation" cellpadding="0" cellspacing="0" border="0">
<tr>
<td bgcolor="#1d4ed8" style="border-radius:4px;padding:12px 24px;">
<a href="https://example.com/offer" style="color:#ffffff;font-family:Arial,sans-serif;font-size:16px;text-decoration:none;">Get started</a>
</td>
</tr>
</table> A single-column wrapper with an Outlook fallback. The conditional comment gives Outlook a fixed-width table, while other clients use the fluid version. Keep the conditional block short, and move Outlook-only fixes into it.
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td align="center">
<!--[if mso]>
<table role="presentation" width="600" cellpadding="0" cellspacing="0" border="0"><tr><td>
<![endif]-->
<table role="presentation" width="100%" style="max-width:600px;" cellpadding="0" cellspacing="0" border="0">
<tr><td style="font-family:Arial,sans-serif;font-size:16px;line-height:24px;color:#111111;">Your message here.</td></tr>
</table>
<!--[if mso]>
</td></tr></table>
<![endif]-->
</td>
</tr>
</table> Which Tool Fits Which Decision
Most teams do not need every tool in the table. The decision usually turns on who writes the template and how often it changes. The table below maps common situations to a recommended starting point and the reason for it.
| If you need | Pick | Because |
|---|---|---|
| A single simple message sent a few times a year | Hand-coded tables, using the snippets above | A build pipeline costs more setup than the template is worth |
| Many similar templates maintained by one developer team | MJML | Shared components mean a fix in one place reaches every template |
| A design system that already uses Tailwind | Maizzle | Classes match the vocabulary your designers and developers already use |
| Confidence that a finished template looks right in real clients | Email on Acid, on top of one of the above | Rendering previews catch client-specific breakage that code review cannot |
| Checks that run automatically on every change | Email on Acid Basic or Premium with API access | Basic includes API access, so previews can run from CI |
Setup and Migration Checklist
Moving an existing template library onto a build tool is easier in small steps. Convert one template end to end first, confirm it renders correctly, and only then move the rest. The checklist below sets out the order and what finished looks like at each step.
| Step | What to do | Done when |
|---|---|---|
| 1. Inventory | List every live template, its sender, and the clients your audience uses | You have a list with client share for each template |
| 2. Pick one build tool | Choose MJML, Maizzle or hand-coded tables, and write down the reason | The team agrees on one path and the reason is recorded |
| 3. Convert one template | Rebuild your most-used template in the new path | Output matches the old design in your target clients |
| 4. Add a rendering check | Run the converted template through a preview service or your own test sends | Known breakages in Outlook and Gmail are fixed or documented |
| 5. Move shared parts | Turn headers, footers and buttons into shared components | Each shared part is edited in one file only |
| 6. Migrate the rest | Convert remaining templates in batches of three to five | Old templates are retired after a campaign has used the new one |
| 7. Document | Write down the build command, the preview step and the owner | A new team member can ship a change without asking the original author |
Coding Rules That Hold in Every Client
Whatever build path you choose, a short set of rules prevents most rendering problems. Use table-based layout for structure. Put critical styles inline on each element, because head styles are stripped by some clients. Set width and height on every image, and set display: block on images that sit inside links so gaps do not appear below them. Use absolute URLs for every asset. Keep padding instead of margin for spacing, since margin support is inconsistent. Avoid flexbox, grid and keyframe animation, which most clients will not display.
Fallback colours matter as much as layout. Set a background colour on the outer table so the email still has a readable surface when images are blocked. Choose a font stack that ends in a system font, and write the message so that the fallback view still reads clearly.
Dark Mode Is a Coding Problem
Dark-mode behaviour depends on how colour values, images and background declarations are written, not only on how a screenshot looks. Clients invert or adjust colours differently, and some change text colour without changing a background that you set explicitly. Prefer logos with transparent backgrounds or an outline, so they do not sit in an obvious white box. Test the compiled HTML in a dark-mode preview, not only the source file in an editor.
Accessibility Is Also Code
Heading order, alt text, link wording and colour contrast all live in the HTML that a developer writes. Design tools cannot correct a heading structure that skips levels, or a link that says only "click here". Put accessibility checks into the template review checklist, so each new template is checked before launch rather than fixed afterwards. An accessibility test in a rendering tool such as Email on Acid Premium can catch some of these issues automatically, but a person still needs to read the message.
Common Mistakes That Cause Rendering Bugs
- Putting all styles in the head and assuming every client keeps them. Inline the critical styles at build time instead.
- Hand-coding every template from scratch, so each one reintroduces the same Outlook bug.
- Previewing only in a desktop browser rather than in the mail clients your audience reads.
- Uploading images at full resolution and scaling them down in the markup, which slows loading and can distort them in Outlook.
- Ignoring Outlook quirks such as image sizing, background images and padding that collapses.
- Sending without a plain-text version or a dark-mode check.
A Workflow That Keeps Templates Stable
Once a template works, the main risk is an untested edit that breaks it weeks later. Keep a single source file per template, compile it with the same command every time, and send a test message after each meaningful change rather than one large test at the end. Store templates in version control, with commit messages that name the campaign, so you can recover last quarter's version when a sender asks for it. If you use a rendering service, run it on the compiled output, because that is what the client receives.
How to Choose
Start with the people who will maintain the template. If a developer team owns email and wants responsive markup generated for them, MJML is the most direct route, and it costs only the build time. If the team already writes Tailwind for the product, Maizzle lets them reuse that knowledge. If the templates are simple and rarely change, hand-coded tables are enough, provided the team follows the snippets and checks above. In all three cases, add a rendering check before the first large send. Email on Acid Basic covers a small team's volume at $99 a month, and Premium covers 2,000 previews at $199 a month. Above that, request pricing from the vendor.
Related reading: the email template design guide, email template best practices, responsive email templates, dark mode email templates, and the template library.
Frequently Asked Questions
Are table layouts still necessary in email HTML?
Yes. Flexbox and grid support varies across clients in ways that are hard to predict, and tables give the most consistent structure. Build tools such as MJML and Maizzle output table-based HTML for you, and hand-coded templates should follow the same pattern.
Which tool should a team with no developer start with?
A team with no developer should start with the hand-coded snippets in this guide, applied to one template at a time. A build tool such as MJML needs someone comfortable running a build step, so it is a better choice once a developer is available to maintain it.
Is MJML free to use?
MJML is self-hosted and its pricing page does not list a subscription. The cost is the time and infrastructure needed to run the build. Check the MJML pricing page for any current terms before you commit.
How many previews do I need from a rendering service?
Count the number of test renders your team runs in a typical month, including every revision of every template. A team checking about 500 previews a month fits within Email on Acid's Basic plan at $99 a month. Around 1,500 previews a month needs Premium at $199 a month, because Basic includes only 1,000.
Can I rely on a preview tool instead of sending test emails?
No. A preview shows a rendering snapshot, but it does not replace a real send to inboxes you control, particularly for dark mode, images-off viewing and the order in which clients load content. Use previews to find breakages early, then confirm the final version with a test send.
Why does Outlook desktop behave differently from webmail?
Outlook for Windows renders HTML with Microsoft Word's engine, which supports a smaller subset of CSS and handles spacing, background images and image sizing differently. Use conservative layouts, bulletproof buttons, and an Outlook-only conditional block for fixes that other clients do not need.
Should plain-text versions be coded by hand?
Write plain text as a deliberate version of the message, not as a stripped copy of the HTML. Keep the content in a logical order, spell out link destinations where they matter, and make sure the unsubscribe path is present. Plain text supports accessibility and readability, so it is worth maintaining alongside the HTML.