How to Add Alt Text to Images
Learn how to add alt text to images in HTML, WordPress, Shopify, Wix, and Squarespace, plus audit missing alt text at scale.
How to add alt text to images means adding a short text alternative that describes an image when the image cannot be seen or loaded. It belongs in the HTML alt attribute, supports accessibility for screen readers, and helps search engines understand image context when the description is accurate and relevant.

Adding alt text is simple for one image. Doing it well across HTML, WordPress, Shopify, Wix, Squarespace, and large legacy libraries is harder.
This guide focuses on the parts most tutorials skip: when to use descriptive alt text versus empty alt, how the image alt attribute works in code, and how to audit missing alt text across many pages with YepAPI's Onpage Instant endpoint.
What alt text is and why it matters#
Alt text is the text alternative attached to an image through the alt attribute on the HTML img element. The HTML Standard defines alt as text that replaces the image when the image is unavailable or when the user cannot perceive it, as documented in the WHATWG definition of the img element and alt text.
Accessibility is the first reason to add it. The W3C Web Accessibility Initiative explains that alt text helps people using screen readers understand the meaning or function of images, and decorative images should use a null text alternative instead, per the WAI images tutorial.
SEO is the second reason. Search engines use surrounding context, filenames, captions, and alt text together to interpret images, so accurate descriptions can support image SEO and page relevance.
Alt text is not the same as a caption. A caption is visible on the page. Alt text is usually not visible unless assistive technology reads it or the image fails to load.
Alt text is also not the image title attribute. Title text can appear as a tooltip in some browsers. It does not replace the need for a proper alt attribute.
If you need the writing rules first, read how to write alt text. If you are auditing broader page quality at the same time, how to conduct a technical SEO site audit covers the wider workflow.
How to add alt text to images#
Use this order of operations for any platform:
- Identify the image's purpose on the page.
- Write alt text only if the image adds meaning or function.
- Use empty alt,
"", for decorative images. - Add the alt text in the CMS or directly in HTML.
- Check the live page and audit templates that reuse the image.
- Prioritize high-traffic and high-conversion pages first when retrofitting old libraries.
That sequence matters because the right first decision is not always "write a description." Sometimes the correct implementation is empty alt.
How to write alt text for images#
Good alt text describes what matters in the image for this page. Bad alt text either repeats nearby copy, crams keywords, or describes useless visual details.
Use these rules:
- Describe the image's purpose in context.
- Keep it concise, but complete enough to replace the image.
- Skip phrases like "image of" or "picture of" unless that detail matters.
- Do not duplicate nearby headings, captions, or product names unless the image adds nothing beyond them.
- Use empty alt for purely decorative images.
- For linked images, describe the destination or action when function matters more than appearance.
Alt text examples#
| Image type | Good alt text | Bad alt text | Why |
|---|---|---|---|
| Product photo | Black leather ankle boots with side zipper | boots shoes fashion buy now | The good version identifies the product clearly. |
| Chart | Bar chart showing organic traffic rising from January to April | chart | The good version conveys the key data point. |
| Screenshot | WordPress image settings panel with alt text field selected | screenshot of settings | The good version explains what the screenshot teaches. |
| Logo | YepAPI | YepAPI logo image | If the logo only identifies the brand, the name is enough. |
| Icon button | Search | magnifying glass icon | Function matters more than shape for controls. |
| Decorative divider | "" | blue curved divider | Decorative images should be ignored by assistive tech. |
Image alt attribute: descriptive alt vs empty alt#
The image alt attribute has two common correct states: meaningful text or empty text. The wrong state for many decorative assets is a missing attribute.
Use descriptive alt text when the image contributes information, teaches a step, identifies a product, or performs a function. Use empty alt when the image is present for layout, spacing, mood, or decoration and adds no information.
Here is the difference in HTML:
- Informative image:
 - Decorative image:

In real HTML, that means an informative image gets a written alt value, while a decorative image gets an empty one. It should not be omitted.
Why not omit the attribute? Because a missing alt attribute can force screen readers to fall back to a filename, URL fragment, or other unhelpful output. Empty alt tells assistive technology to skip the image.
How to add alt text in HTML#
If you edit templates or static pages directly, add alt text inside the img tag's alt attribute.
Use this pattern for informative images:

Use this pattern for decorative images:

The key implementation detail is that the alt attribute belongs on the image itself. It is not stored in CSS, not replaced by the filename, and not handled by the caption.
For linked images, write alt text based on the image's job. If a logo links back to the homepage, the alt may simply be the brand name. If a button image submits a form or opens a resource, describe the action instead.
If you are reviewing other HTML issues at the same time, YepAPI's on-page content checks help you inspect page elements in code, and Onpage Instant is the faster choice when you want a technical snapshot of a live URL.
How to add alt text in WordPress#
In the block editor#
- Open the post or page.
- Select the image block.
- Find the alt text field in the block settings sidebar.
- Add a concise description or leave it empty if the image is decorative.
- Update the page.
In the media library#
- Open Media.
- Select the image.
- Add text in the Alt Text field.
- Save.
- Confirm that the theme outputs that value on the front end.
This last step matters because some themes, builders, or custom fields override the media library value. If the live HTML is wrong, the CMS entry alone does not solve the issue.
For a broader WordPress page-quality checklist, see how to do on page SEO.
How to add alt text in Shopify, Wix, and Squarespace#
Many tutorials stop at WordPress. Teams on other platforms still need the same decision rules.
Shopify#
Open the product, collection, or content editor. Select the image. Add alt text in the image details field. Save, then inspect the live product page because template apps and gallery sections can output image markup differently.
Wix#
Open the page in the editor. Select the image. Open settings or the accessibility field for the image. Add descriptive alt text or leave it empty for decorative assets. Publish and verify the rendered page.
Squarespace#
Open the image block or page section. Edit the image metadata or filename settings area used by the template. Add alt text, save, and then confirm the live HTML because template families may surface fields differently.
The CMS path changes by platform, but the rule does not: write alt based on meaning, not on the fact that an image exists.
Alt text for SEO#
Alt text for SEO helps most when it improves understanding of the page, not when it repeats target keywords. Keyword stuffing in alt text creates poor accessibility and weak signals.
A good image SEO workflow combines several cues:
- accurate alt text
- relevant surrounding copy
- descriptive file names
- useful captions when needed
- sensible image placement on the page
If your images are linked, context also matters. The linked image behaves like anchor text for the destination, which is why image function can be more important than visual description. That is one reason image semantics belong inside broader technical SEO best practices, not in an isolated image checklist.
Common alt text mistakes#
Most teams do not fail because they forgot what alt text is. They fail because the workflow encourages shortcuts.
Avoid these mistakes:
- Writing alt text for decorative images instead of using empty alt.
- Leaving the alt attribute missing altogether.
- Copying the filename into the field.
- Repeating the page keyword unnaturally.
- Duplicating the visible caption word for word.
- Using the same generic alt across an entire product category.
- Forgetting that templates and components can override CMS values.
If your site has many template issues beyond images, the roundup on best on page SEO analysis tools can help you choose the right review workflow.
Audit missing alt text across many pages#
Manual edits solve single pages. Large sites need a repeatable audit.
Start with pages that matter most:
- pages that drive traffic
- pages that convert
- templates used across many URLs
- image-heavy content such as ecommerce, recipes, galleries, and guides
Then check the rendered output, not just the CMS field. What matters for accessibility and SEO is the final HTML users and crawlers receive.
YepAPI's Onpage Instant endpoint is the practical way to do this at scale in code. You can send a URL, inspect the returned page analysis, and flag pages where image alt coverage is missing, empty when it should be descriptive, or inconsistent across similar templates.
For larger audits, pair that with YepAPI's web scraping API when you need to collect URLs or rendered page inputs from a site inventory before checking them. If you need Lighthouse-style technical checks as part of the same workflow, YepAPI's Onpage Lighthouse endpoint can extend the audit beyond image markup.
A simple team workflow looks like this:
- Export or collect priority URLs.
- Request each page with an automated checker.
- Extract image markup from the rendered HTML.
- Classify images as informative, functional, or decorative.
- Flag missing alt attributes and weak repeated values.
- Route fixes to the CMS owner or template developer.
- Re-run the audit after deployment.
If your process already uses Python or JavaScript, keep the results in a spreadsheet or issue tracker so editors and developers can split ownership cleanly.
Team workflow for large image libraries#
Single-image advice does not scale. Teams need governance.
Use this operating model:
- Create an alt text rule sheet by image type: product photo, chart, screenshot, logo, icon, decorative image.
- Add examples of good and bad alt text for each type.
- Decide when editors can write alt and when developers must handle template logic.
- Reserve empty alt for decorative assets in shared components.
- Audit legacy media on high-value sections first.
- Add QA checks before publishing new pages.
This is where YepAPI's Onpage Instant endpoint becomes more than a one-off checker. It gives teams a way to validate the final output repeatedly instead of trusting that every editor, plugin, and template handled the image alt attribute correctly.
Final checklist#
Before publishing, ask these questions for every image:
- Does this image add information or function?
- If yes, does the alt text replace that meaning clearly?
- If no, is the alt attribute present but empty?
- Does the live HTML match the CMS field?
- Has the team checked templates on key page types?
That checklist catches more issues than simply asking whether a field was filled in.
Add alt text in code and audit it at scale#
If you need more than manual CMS edits, YepAPI's Onpage Instant endpoint helps you check rendered pages for missing or weak image alt implementations across a site. You can start with priority URLs, automate reviews, and turn accessibility and image SEO checks into a repeatable QA process.
Pull live page analysis with YepAPI's Onpage Instant endpoint — $5 free credit, no card.
FAQ#
Can you add alt text to Instagram photos?#
Yes, Instagram supports custom alt text on image posts. You add it during publishing or by editing the post later, but the exact menu can vary by app version. Keep the text descriptive and specific to the image, and do not treat hashtags or captions as a substitute for a real text alternative.
How to create an alt text for an image?#
Start by asking what the image adds to the page. If it adds meaning, write one short description that replaces the image in context. If it is only decorative, use empty alt instead of a description. Good alt text is specific, concise, and focused on meaning rather than visual filler words.
How do I add alt text to images on my Wix website?#
In Wix, open the page editor, select the image, and use the image settings or accessibility field to enter alt text. Write a description only if the image conveys information or function. After publishing, inspect the live page to confirm the final HTML outputs the alt attribute the way you intended.
What is alt text?#
Alt text is the text alternative stored in an image's HTML alt attribute. It is read by screen readers and used when an image cannot be displayed. Its main job is accessibility, but it also helps search engines understand image context when the text is accurate, relevant, and not stuffed with keywords.
Topics