---
title: "HubSpot How To: Lazy Load Images in Rich Text Modules"
description: "2021 Update: since writing this article there is a new HTML attribute loading=”lazy” that you can add to your <img> tag which replaces the old JavaScript method below. HubSpot is also adding lazy loading options across their entire platform so that you don’t have to manually edit the markup. 🎉 Lazy loading images on HubSpot […]"
image: https://modern.kelp.agency/hubfs/woman-using-laptop-computer-with-vr-headset.jpg
---

[Skip to Content](https://modern.kelp.agency/blog/hubspot-how-to-lazy-load-images-in-rich-text-modules#main-content)

Kelp Creative Agency logo dark

[![Modern Pro](https://modern.kelp.agency/hubfs/modern-pro-assets/modern-pro-dark.svg "Modern Pro")](https://modern.kelp.agency/)

Kelp Creative Agency logo light

[![Modern Pro](https://modern.kelp.agency/hubfs/modern-pro-assets/modern-pro-light.svg "Modern Pro")](https://modern.kelp.agency/)

- Page Layouts 
    - [Home](https://modern.kelp.agency)
    - [Services](https://modern.kelp.agency/template-services)
    - [Contact](https://modern.kelp.agency/contact)
    - [Landing](https://modern.kelp.agency/template-landing)
    - System 
          - [404 Error](https://modern.kelp.agency/404)
- [Documentation](https://modern.kelp.agency/docs) 
    - [Theme Options](https://modern.kelp.agency/docs#theme-options)
    - [Templates](https://modern.kelp.agency/docs#templates)
    - [Modules](https://modern.kelp.agency/docs#modules)
- [Blog](https://modern.kelp.agency/blog)

Search 

[Purchase Theme](https://ecosystem.hubspot.com/marketplace/website/modern-pro-theme-by-kelp-creative-agency)

Menu

## Search

 HubSpot How-Tos

# HubSpot How To: Lazy Load Images in Rich Text Modules

 written by **Stefen Phelps**

![bench-accounting](https://modern.kelp.agency/hs-fs/hubfs/woman-using-laptop-computer-with-vr-headset.jpg?width=1200&height=802&name=woman-using-laptop-computer-with-vr-headset.jpg)

---

**2021 Update:** since writing this article there is a new HTML attribute `loading="lazy"` that you can add to your `<img>` tag which replaces the old JavaScript method below. HubSpot is also adding lazy loading options across their entire platform so that you don’t have to manually edit the markup. 🎉

---

Lazy loading images on HubSpot can be tricky when it comes to images that are added in Rich Text Modules. Since there isn’t a way for a developer to control the markup those images output onto the page, it requires a bit of HTML tweaking inside the rich text editor itself.

Personally, I recommend avoiding adding images to rich text modules all-together and, instead, use a well designed template/custom module combo that can accommodate your site’s design and have lazy loading built-in. However, if you don’t have the time or budget to hire a developer, here’s the quick n’ dirty way to lazy load images inside of rich text modules:

## Step 1: Add JavaScript

Add the following to the “Footer HTML” in your page’s advanced settings:

```
<script src="https://cdn.jsdelivr.net/npm/vanilla-lazyload@8.17.0/dist/lazyload.min.js"></script>
```

The first script of this snippet adds a lazy loading image plugin to your page and the second script initializes it.

## Step 2: Modify Your <img> tags

Inside each of your rich text areas with images in them, click on the “Source Code” button—the icon that looks like this: </>—and find each image tag’s `src` attribute and change it to `data-src`. For example, an image that looks like this: `<img src=‘example.jpg'>` needs to change to this: `<img data-src='example.jpg’>`

Like I said before, I don’t recommend doing things this way as it’s a bit tedious and can easily be broken. But, if you don’t have the time or resources to develop a template or a custom module that supports lazy loading and just need a quick page speed boost to your existing pages with minimum effort, this will do it for ya you crazy devil, you.

## Recent Blog Posts

[Partners VS Pirates: Navigating an Ocean of Digital Agencies](https://modern.kelp.agency/blog/partners-vs-pirates-navigating-an-ocean-of-digital-agencies)

## Partners VS Pirates: Navigating an Ocean of Digital Agencies

 Ready to go on a journey? Let me paint you a picture. Your business is your island, and the internet is the digital ocean connecting you to...

 Read more 

![](https://modern.kelp.agency/hs-fs/hubfs/black-flat-screen-computer-monitor.jpg?width=800&name=black-flat-screen-computer-monitor.jpg)

[Improving Your Design and Conversion with Contrast](https://modern.kelp.agency/blog/improving-your-design-and-conversion-with-contrast)

## Improving Your Design and Conversion with Contrast

 Most digital professionals realize that getting a user’s attention is a primary factor in achieving your online goals. We’ve all seen the...

 Read more 

![](https://modern.kelp.agency/hs-fs/hubfs/woman-holding-tablet-computer.jpg?width=800&name=woman-holding-tablet-computer.jpg)

[Perfection Paralysis: Stay Calm, Create on](https://modern.kelp.agency/blog/perfection-paralysis-stay-calm-create-on)

## Perfection Paralysis: Stay Calm, Create on

 Any good creative producer will tell you their goal is to create something better than they did before. That’s not too hard of an ask. Is...

 Read more 

![](https://modern.kelp.agency/hs-fs/hubfs/modern-toy-robot-on-bright-shelf-near-wall.jpg?width=800&name=modern-toy-robot-on-bright-shelf-near-wall.jpg)

## Lorem Ipsum Sit Amet

 Lorem Ipsum Dolor

[![Modern Pro](https://modern.kelp.agency/hubfs/modern-pro-assets/modern-pro-light.svg "Modern Pro")](https://modern.kelp.agency/)

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque ut fringilla turpis, vehicula tempus neque.

[Follow us on Facebook](https://www.facebook.com) [Follow us on LinkedIn](https://www.linkedin.com) [Follow us on Twitter](https://www.twitter.com) [Follow us on Instagram](https://www.instagram.com)

##### Lorem Ipsum

- Aliquam sed
- Aliquam sed
- Aliquam sed
- Aliquam sed

##### Lorem Ipsum

- Aliquam sed
- Aliquam sed
- Aliquam sed
- Aliquam sed

### Subscribe Here!

Copyright © 2026 Kelp Creative Agency

- Terms of Use
- |
- Privacy Policy