HTML email creation hub

How to embed an image in an email

Discover how to optimize your images for emails to grab your reader's attention and tell your story at a glance.

Embedding images in emails goes beyond just attaching a picture. It's about seamlessly integrating visuals into your email content, ensuring that they display correctly across different devices and email clients. 

Embedded images are part of the email's HTML code, making them an integral part of the message rather than just an add-on. 

Benefits of embedding images in emails

Embedding images directly into your email can transform a plain message into a visually engaging one. According to Mailmunch, emails with images see an average click-through rate that is 42% higher than those without images. 

When images are used strategically, they can guide the reader's attention, highlight key points, and encourage click-throughs to your website or landing page. Equally so, images can divide large blocks of text, making the content easier to digest and more inviting to read. 

How to embed images in emails

Inline HTML

Inline embedding involves adding images directly into the body of your email using HTML code. This is commonly used in more complex email designs where precise control over image placement is needed. For example, a marketing email with a custom layout might use inline embedding to ensure that images align perfectly with the surrounding text

This method gives you greater control over the placement and appearance of your images. The process typically involves using the <img> tag within your email's HTML code, specifying the image source (URL), and setting parameters such as width, height, and alt text.

Step-by-step: 

  1. Start by uploading your image to a web server or a cloud storage service that provides a direct link to the image.
  2. In your email’s HTML code, insert the following snippet: <img src="https://example.com/image.jpg" alt="Descriptive ALT text" width="600" height="400">
  3. Adjust the image src attribute to match the URL of your hosted image.
  4. Customize the width, height, and alt text to suit your needs.

Key considerations: 

  • Ensure the linked images are hosted on a fast, reliable server to minimize loading delays.
  • Regularly check that your image links are active and not broken.
  • For images with text overlays, use web-safe fonts and colors to ensure readability and consistency across platforms.

CID image embedding

CID (Content-ID) embedding involves attaching images to the email as separate files and referencing them within the email’s HTML code. This method ensures that embedded images are displayed even if the recipient’s email client is set to block external images.

This method is often used in transactional emails or to ensure that key brand elements such as a logo are always visible.

Step-by-step: 

  1. Attach the image to your email and assign it a unique content ID (CID).
  2. In your email’s HTML code, use the following snippet: <img src="cid:unique-content-id" alt="Descriptive ALT text">
  3. Replace unique-content-id with the actual CID assigned to the image attachment.
  4. Customize the image’s properties as needed.

Key considerations:

  • Use CID embedding sparingly, as it can increase the overall size of your email.
  • Ensure all attached images are properly formatted and optimized for email.
  • Test the email in various clients to confirm that the CID images display correctly.

Drag-and-drop builder

For those with limited HTML experience, a drag-and-drop builder is your best friend. Many of the popular email sending platforms offer drag-and-drop capabilities, such as HubSpot or Mailchimp, but if you find those platforms hard to use, a no-code email builder like Beefree may be a solution.

Drag-and-drop builders allow you to simply select an image from your computer or a library and drop it into the email itself. From there, the platform automatically generates the necessary HTML code.

Best practices for embedding images: What not to do

1. Ignoring email client compatibility

One of the most common pitfalls when learning how to embed graphics in email is ignoring the compatibility across different email clients. Not all email clients handle images the same way—what looks perfect in Gmail might not render correctly in Outlook.

This can lead to broken layouts, distorted images, or even missing visuals, which can negatively impact your email’s effectiveness.

How to test for compatibility 

By testing emails across different clients you can preserve both the integrity of the design and the user experience.

Tools like Litmus and Email on Acid offer comprehensive testing features that allow you to see how your emails will render in popular email clients like Gmail, Outlook, and Apple Mail. They also provide insights into potential compatibility issues, enabling you to make necessary adjustments before you hit send!

2. Overloading emails with too many images

While images are powerful tools for enhancing email content, overloading your emails with too many visuals can backfire. An email cluttered with images can overwhelm the reader, slow down loading times, and even trigger spam filters.

It’s important to strike a balance between text and images to maintain a clean, professional design. A well-designed email should seamlessly integrate images with text, allowing each element to complement the other.

3. Not optimizing for mobile

Your emails should offer readers with a seamless experience regardless of whether they’re viewing it on a desktop, tablet, or smartphone. Images that are too large can cause issues like slow loading times or awkward layouts on smaller screens.

Be sure to test your emails on various devices to check how the images and overall design render on each one.

Image optimization tools 

TinyPNG, JPEG-Optimizer, and ImageOptim are widely used for compressing image files to reduce their size.

4. Not using descriptive ALT text

ALT text is crucial when an image doesn’t load properly, a user has visual impairments, or when the email client doesn’t render images properly as it provides important context to the email. Without it, recipients might miss out on essential information, decreasing the impact of your email. 

Troubleshooting embedded image issues

“Broken images”

This problem occurs when the email client cannot access the image source, often due to incorrect file paths, permissions, or hosting issues.

Common causes:

  • Incorrectly linked URLs or file paths
  • Images hosted on unreliable or slow servers
  • Permissions settings that restrict image access
  • Email client settings blocking external images

How to fix it: 

  1. Double-check the image URLs or file paths in your email’s HTML code to ensure they’re correct.
  2. Host your images on a reliable server with fast loading times and stable uptime.
  3. Adjust permissions to allow public access to the images.
  4. Consider embedding critical images directly in the email or using CID embedding to avoid reliance on external hosting.

“Slow loading times”

Slow-loading images can frustrate recipients, causing them to abandon your email before it fully loads.

Common causes:

  • Large image files that haven’t been optimized for the web
  • Images hosted on slow or overloaded servers
  • Embedding too many images in a single email

How to fix it:

  • Optimize your images with tools like TinyPNG or ImageOptim to reduce file size without compromising quality.
  • Host images on fast, reliable servers to ensure quick loading times.
  • Limit the number of images in your email and prioritize quality over quantity.

“Images not displaying correctly on mobile”

When images don’t display correctly on mobile devices, it can disrupt the entire design of your email, making it difficult for recipients to read or engage with your content. 
‍
Common causes:

  • Non-responsive images that don’t scale to fit different screen sizes
  • Fixed-width layouts that don’t adjust for smaller screens
  • Misalignment of images and text in mobile view

How to fix it:

  • Use responsive design techniques, including flexible image sizes and media queries, to ensure images adjust correctly on all devices.
  • Test your email on multiple mobile devices and screen sizes to catch and correct any display issues.

HTML email creation from A-Z