<p>Out of the box, you can use the image "Title" as alt text.  Since it is already configured - you don't need to add any additional fields.  Then you can output this in your twig template as:</p>

<pre><code>{% set image = image.yourImageField.one() %}
&lt;img src="image.url" alt={{ image.title }}"&gt;
</code></pre>

<p>For semantics, you may not want to use the "Title" field.  Or, you may be using "Title" for something else.  In that case, you can add a new text field to your asset called "Alt Text".  It will then appear right below "Title" in your image/asset editing dialogue.  </p>

<pre><code>{% set image = image.yourImageField.one() %}
&lt;img src="image.url" alt={{ image.altText }}"&gt;
</code></pre>

<p><a href="https://i.sstatic.net/ZCDvT.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ZCDvT.png" alt="enter image description here"></a></p>

CC BY-SA 4.0
2019-07-29T20:22:04.747Z
Thank you very much - one more question if you don't mind. How do I update the twig template?
jason
CC BY-SA 4.0
2019-07-29T19:45:23.590Z
2019-07-29T19:45:23.590Z
gjhead
<p><strong>An updated answer for 2023:</strong> Alternative Text is available to assets as a native field in Craft CMS 4.</p>
<p>To enable it, within Settings &gt; Media: Assets &gt; Volumes &gt; Field Layout, add the &quot;Alternative Text&quot; field found in the sidebar to the asset content (see screenshot).</p>
<p>Within your template, use <code>asset.alt</code> to render. Your image call could look something like this:</p>
<pre><code>{% set asset = block.imagefieldname.one() %}
&lt;img src=&quot;{{ asset.url }}&quot; alt=&quot;{{ asset.alt }}&quot; /&gt;
</code></pre>
<p><strong>To edit the alt field:</strong></p>
<ul>
<li>When on an entry: after adding an asset to a field, double click the asset to open a contextual menu.</li>
<li>From the Assets dashboard: just click the asset.</li>
</ul>
<p>Note: <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#the_title_attribute" rel="nofollow noreferrer">Mozilla recommends not using the HTML <code>title</code> attribute</a>. From CraftCMS dev perspective, it's not recommended to render title field as the alt text either as you cannot leave it blank for decorative images. There's probably use cases for it but I haven't discovered them.</p>
<p><a href="https://i.sstatic.net/eRdJg.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/eRdJg.png" alt="Screenshot of Media Assets and where to find Alternative Text field" /></a></p>

CC BY-SA 4.0
2023-03-02T04:44:06.443Z
2023-03-02T04:44:06.443Z
franklylately
<p>I am trying to figure out how to add alt image tags to my photos. I was under the impression that the "file name" served as the alt image tag in Craft CMS, but no such alt tags are populating...and furthermore...I really have no idea where I can add them. Can I do this from the assets field?</p>

<image>
How do I add Alt Image Tags to my photos?
# How do I add Alt Image Tags to my photos?

(Asked by: username_0 on 2019-07-29)

I am trying to figure out how to add alt image tags to my photos. I was under the impression that the "file name" served as the alt image tag in Craft CMS, but no such alt tags are populating...and furthermore...I really have no idea where I can add them. Can I do this from the assets field?

**Tags:** image

---

## 2 answers

### Answer by username_1 on 2019-07-29. Score: 4

Out of the box, you can use the image "Title" as alt text.  Since it is already configured - you don't need to add any additional fields.  Then you can output this in your twig template as:
{% set image = image.yourImageField.one() %}


For semantics, you may not want to use the "Title" field.  Or, you may be using "Title" for something else.  In that case, you can add a new text field to your asset called "Alt Text".  It will then appear right below "Title" in your image/asset editing dialogue.  
{% set image = image.yourImageField.one() %}

> **Comments:**
> **username_0**: Thank you very much - one more question if you don't mind. How do I update the twig template?  

---

### Answer by username_2 on 2023-03-02. Score: 3

An updated answer for 2023: Alternative Text is available to assets as a native field in Craft CMS 4.
To enable it, within Settings > Media: Assets > Volumes > Field Layout, add the "Alternative Text" field found in the sidebar to the asset content (see screenshot).
Within your template, use asset.alt to render. Your image call could look something like this:
{% set asset = block.imagefieldname.one() %}


To edit the alt field:

When on an entry: after adding an asset to a field, double click the asset to open a contextual menu.
From the Assets dashboard: just click the asset.

Note: Mozilla recommends not using the HTML title attribute. From CraftCMS dev perspective, it's not recommended to render title field as the alt text either as you cannot leave it blank for decorative images. There's probably use cases for it but I haven't discovered them.


---

