Skip to main content
To KTH's start page To KTH's start page

Captions and alt texts

Images on the web need text. We must write an alt text so that the image can be understood even by people who do not read with their eyes. Sometimes, we also need a caption to explain or enhance the image.

Alt texts that people and search engines like

  • Relevant images related to the text.
  • Images without text but supplemented in the body of the text.
  • Lightweight images, i.e. not heavy to download.
  • Descriptive file names.
  • Descriptive alt texts.

The difference between caption and alt text

The caption is next to or below the image and is visible to everyone. The caption should add more than what you see directly in the image.

The alt text (or image description/alternative text) should convey what the image represents for those who cannot see images. It is also essential for search engines.

Captions

Captions are not mandatory but you can use them when you want to describe something that is not visible in the image but still adds meaning for the reader. This could be, for example, Västerbron in Stockholm, under a picture of a bridge.

If you need to credit the photographer, the caption is a suitable place. It should not be placed in the alt text.

Alt texts

Under the web directive, images important for understanding the page's content must have a descriptive alternative text, known as an alt text. This is particularly important for people with impaired vision or others who use screen readers. The alt text should describe what they cannot otherwise see so that they can understand the content of the page.

Alt texts are also displayed even if the image does not load for some reason. For example, the page can still be understood even by those with a poor connection.

Search engines use alt texts to understand the images on the page and can index the image and your page better.

If the image is only decorative or reproduces what is also in the text on the page, you should avoid adding alt text. Decorative images should be used with caution.

When do we use images?

Inserting images in Polopoly (in Swedish)

The law requires: describe with text all non-text content (webbriktlinjer.se.se)

A good alt text

An alt text should explain what is shown in the image and preferably also the purpose of the image in context. You should be able to understand what is important in the image without seeing it. Describe the image precisely, e.g. for a picture of the courtyard on the KTH campus, you could write:

The buildings are made of red brick and there are green areas to sit on.

Also, give the image files a descriptive name before uploading them. For example, 'borggard-campus' is a better name than 'img_20754' if you write a text about our campuses.

Increase your ranking in the search engines

Use your keywords for the page also in the alt text. This creates a context for both visitors and search engines.

Search Engine Optimisation (SEO)