How to Embed HTML in Gmail: A Step-by-Step Guide

24.4.2022
Read time: 13 min
Try Publicate For Free Today
Start Now
How to Embed HTML in Gmail: A Step-by-Step Guide
Try Publicate For Free Today
24.4.2022
Read time: 13 min

If you have found yourself trying to embed HTML in Gmail, you probably know that it is not as easy as copying and pasting code into a new email.

GMail doesn't support the editing of HTML beyond some very basic text styles, pasting in HTML code will simply render the code as text. If you do manage to paste in some rendered HTML the GMail client will send it but only after doing some pretty heavy processing on it, a lot of your styles and layout will be lost.

All of this is because Gmail was designed as an email platform with a visual editor and not as a platform for building HTML emails. 

However, it is important to note that creating HTML emails in Gmail is not impossible. It just means that the process will require the correct workflow. 

With Publicate, your team can develop HTML emails visually, avoid manual HTML work and export directly into Gmail without relying on formatting, coding or work arounds.

Guide Index

What Does “Embedding HTML in Gmail” Actually Mean?

Explain: Embedding HTML in Gmail means inserting a fully designed HTML email into Gmail’s compose window so it displays as a formatted email rather than raw code. 

This is an important distinction because Gmail treats HTML very differently depending on how it is added: 

  • Raw HTML code is the underlying HTML that is used to structure an email. If it is pasted directly into Gmail, it will probably appear as text rather than as a well-designed email.
  • Rendered HTML code is the visual version of the code once it has been processed and displayed with formatting, buttons, images and layouts. 
  • Gmail’s compose editor works on a WYSIWYG (what you see is what you get) basis. This means that it is designed to let users create emails visually as opposed to editing HTML directly. 

With the above in mind, creating an HTML email for Gmail is usually complicated. The challenge is getting Gmail to display the email correctly while also ensuring the correct formatting, style and responsiveness. 

Why Gmail Doesn’t Support Raw HTML Editing

Gmail was originally created to make email design simple and this is why it works in a visual WYSIWYG editor style rather than exposing direct HTML editing.

The result of this is that Gmail does not work like a webpage editor or development environment where raw HTML can be rendered freely. 

There are a few reasons for this including: 

  • Gmail strips unsupported HTML and CSS in order to improve compatibility and security
  • External CSS support is limited
  • Javascript is not supported
  • Some layouts may be modified during rendering
  • Emails need to display consistently across devices and inbox environments 

This is why raw HTML pasted directly into Gmail appears as code instead of a designed email. To sum it up, embedding HTML in Gmail is more complicated than it should be.

How to Embed HTML in Gmail

There are a variety of ways to embed HTML in Gmail, but not all are equally reliable. The correct approach depends on whether you are comfortable working with code or simply want to send a well-designed email. 

Method 1: Paste Rendered HTML into Gmail

This is most common for manual workflow.

Steps:

  1. Create your HTML email
  2. Save it as .html file
  3. Open the file in a browser
  4. Copy the rendered version of the email
  5. Paste it into Gmail’s compose window

As Gmail handles rendered HTML more effectively than it does with raw code, this approach produces better results. 

Limitations:

  • Formatting can still break
  • Images and spacing may shift
  • You have to host images on your own server
  • Testing is usually required
  • The process is manual and time-consuming

Method 2: Use Chrome Developer Tools

As opposed to the above, this is a more technical workaround. 

Steps:

  • Open a Gmail compose window
  • Open developer tools and inspect the body of the email
  • Locate the editable div or content area
  • Replace the content with HTML
  • Preview and send

Limitations: 

  • This is a more technical setup
  • Again, you would need to host any images on a server
  • It is easy to break formatting
  • Difficult to repeat or scale

This method is better suited to advanced and technical teams. 

Method 3: Use an HTML Email Builder (Recommended)

Out of all of these options, this is most certainly the simplest approach to avoid manual HTML embedding altogether. 

Steps:

  1. Design your email visually with a drag and drop editor
  2. Export directly into Gmail, often through a direct integration
  3. Send without touching code

With Publicate, teams are able to create HTML emails with the powerful drag and drop editor and send them through Gmail directly with the deep Gmail integration.  This is done without working with raw HTML, manual formatting or repeated testing, which makes it smooth and streamlined, while helping to maintain consistent email design.

What Gmail Supports (and Doesn’t Support) in HTML Emails

Before embedding HTML in Gmail it is important to understand that Gmail does not support all HTML and CSS features. While Gmail is able to display designed HTML emails professionally, there are also limits regarding styling, responsiveness and advanced functionality. All of this can greatly affect how an email will appear once it has been delivered. 

Take a look at the table below for more insight: 

Feature Gmail Support
Inline CSS
External CSS
JavaScript
Animated GIFs Partial
Responsive layouts Partial
Web fonts Specific Ones

By understanding the limitations, you are able to create HTML emails that will render consistently and reduce the risk of broken formats, styles and layouts. For organisations and teams creating HTML emails regularly, using a template and email builder will remove much of the manual and time-consuming trial and error work that is involved with working in Gmail's constraints. 

Why Coding HTML Emails Manually Is Difficult

Coding in HTML may seem similar to building a webpage but in practice, email HTML works differently. This is because it requires additional testing in order to achieve consistent results. 

Some of the most common challenges include:

  • Email HTML behaving differently from website HTML
  • Different rendering engines across inbox providers
  • Inconsistencies between Outlook and Gmail 
  • Time consuming testing
  • Image hosting and media hosting complexity

This is why most teams use HTML email builders instead of coding emails manually.

Can You Embed HTML in Gmail Without Coding?

Yes, you can embed HTML in Gmail using an email builder like Publicate as it removes the need to write or test HTML manually.

With Publicate, teams are able to create beautiful HTML emails, all without writing code or hosting images. You can then even send through Gmail without even leaving Publicate, using the deep Gmail integration. Features such as templates, drag-and-drop editing, Gmail export and responsive optimisation removes the manual work and helps emails render consistently across devices and inboxes. 

Best Practices for Embedding HTML in Gmail

Embedding HTML in Gmail becomes easier when emails are built around best practices. 

Use the below checklist before you click send: 

  • Use inline CSS instead of external stylesheets 
  • Keep layouts simple and easy to quickly scan
  • Use email-safe fonts where possible
  • Host images externally instead of embedding large files (or use an email builder and this is taken care of for you)
  • Test emails before sending
  • Optimise layouts for mobile
  • Avoid unsupported HTML elements

By following these best practices, you will reduce formatting problems, improve rendering consistency and create emails that display across devices and inboxes. 

Learn more about how to create HTML emails with Publiciate. 

Common Problems When Embedding HTML in Gmail

Even when HTML email looks right during the creation, many issues can arrive once it has been added into Gmail or viewed on different screens and inboxes.

Some of the most common problems when embedding HTML emails in gmail include: 

  • Broken Formatting: Misaligned layouts and spacing issues
  • CSS Issues: Gmail strips unsupported CSS and external stylesheets unsupported
  • Images Not Displaying: Images need hosting, and attachment problems
  • Font Problems: Limited email-safe fonts and fallback rendering
  • Mobile Rendering Issues: Different rendering across devices

Most of these issues will happen because email HTML works and behaves differently from standard web HTML. By using a purpose built email builder and tested templates, you will dramatically reduce troubleshooting and render emails more consistently. 

Create and Export HTML Emails Faster with Publicate

Manually embedding HTML in Gmail can very quickly become time-consuming and repetitive. Many teams will end up having to troubleshoot formatting problems, images and test layouts every single time an email needs to be sent. 

Publicate solves all of this. We simplify the process by empowering teams to create HTML emails using a visual drag and drop editor. They are then able to send the newsletter through Gmail, without even leaving Publicate and without having to work with raw code. 

With Publicate, teams are able to:

  • Build emails using a drag-and-drop builder
  • Send  directly through Gmail using the deep integration
  • Choose from 300+ email templates
  • Create mobile responsive layouts
  • Manage media with built-in hosting
  • Create beautiful emails without coding

Publicate also empower teams to go beyond email creation by offering: 

  • Performance and analytics tracking, even for newsletters sent in Gmail
  • Heatmaps and engagement insight
  • Team collaboration tools and feedback and approval links
  • Professionally designed templates and content modules
  • Reusable templates, content modules
  • Expert time saving brand features

Rather than managing HTML manually, Publicate allows teams to create, optimise and export emails faster while ensuring brand consistency. 

Learn how to send HTML emails in Gmail, with Publicate. 

Gmail vs HTML Email Builders

There are a variety of ways to create and send HTML emails. However, the experience can vary significantly depending on whether you are working directly with Gmail or using a professional HTML email builder. 

Below, we take a closer look at Gmail vs Publicate to give you further insight into what will work best for your email goals.

Task Gmail Alone Publicate
Write HTML Manual No code
Host images Manual Automatic
Responsive design Difficult Built in
Templates Limited 300+
Testing Manual Optimised
Analytics None Advanced

Based on the above, Gmail may be enough for occasional emails. But for teams that are creating newsletters, recurring communication or campaigns, an HTML email builder will simplify it all. Publicate will improve consistency, simplify design and reduce manual work. 

HTML Templates for GMail

Below are some popular HTML newsletter templates for use in Gmail;

Start Embedding HTML Emails in Gmail the Easy Way

Manually embedding HTML in Gmail can work but it is not the fastest and most reliable approach, at all. With formatting breaks, unpredictable images and the need for consistent testing, manually embedding HTML in Gmail can become difficult and time consuming.

Publicate is here to remove the complexity by helping teams design HTML emails visually, optimise layouts automatically and export directly into Gmail. All of this is done without relying on manual HTML workflows. 

Begin creating HTML emails today with Publicate. 

Start your free trial.