BeginnerLesson 5 of 305 min read

The media library: images, sizes and alt text

Prepare and upload images the right way: resize and compress, name files clearly, add alt text, understand WordPress image sizes, with real size results.

In this lesson you will

  • Prepare images before upload
  • Add alt text and a featured image
  • Understand WordPress image sizes
  • Keep the library tidy

About 15 minutes

Pictures that help instead of slowing the site down

Tariq uploads a photo straight from his phone to his new cake page. It is 6 MB. The page, which used to open instantly, now takes ten seconds on a mobile connection, and visitors leave before the cakes appear. Pictures make a site attractive, but unprepared pictures make it slow. In this lesson you will learn how the media library works, how WordPress resizes pictures for you, how to prepare images in a sensible way and how to add the alt text that helps everyone.

The media library

Every file you upload goes into Media: images, PDFs, audio and video. You can upload from Media, Add New, or directly inside a block, and you can drag files onto the screen. In the library, click a file to see its address, title, caption, description and alt text. You can also filter by type and date, and delete what you no longer use. Your host limits the size of each upload. On the test site used for this lesson the limit is 2 MB, and yours may differ, so check Media, Add New.

Three steps before you upload

  1. Resize. A phone photo may be 4000 pixels wide, but a content area is rarely wider than 1200 to 1600 pixels. Resize to about that width (or twice the size you show it at, for sharp screens).
  2. Compress. Save as JPEG at a moderate quality, or use a tool or plugin that compresses for you.
  3. Name it clearly. Use chocolate-birthday-cake.jpg, not IMG_4412.jpg. WordPress turns spaces and odd characters into hyphens, as the test below shows.

Real numbers: size and quality

A synthetic test picture (a colour gradient with a little noise, 3000 by 2000 pixels, to imitate a photo) was saved in several ways. The sizes are real, but your own photos will behave differently:

Version Size
3000 px wide, JPEG quality 95 1686 KB
1600 px wide, JPEG quality 95 599 KB
1600 px wide, JPEG quality 80 278 KB
1600 px wide, JPEG quality 60 184 KB
1600 px wide, WebP quality 80 202 KB

Resizing alone cut the file to about 36% of the original, and dropping the quality from 95 to 80 saved a lot more with little visible change. Very low quality starts to look blotchy, so check by eye. WebP is a newer format that is often smaller than JPEG at the same look; modern WordPress accepts it, though you should check your visitors’ browsers and your host. Use PNG for screenshots and logos with sharp edges or transparency, and JPEG or WebP for photographs.

What WordPress does with your upload

When you upload an image, WordPress automatically creates smaller copies of it for different places, so a thumbnail does not load the huge original. The test site was given the 1600-pixel picture and asked to process it as an upload, then to report the copies it made. The output is real:

original: 1600x1066
medium        300x200
large         1024x682
thumbnail     150x150
medium_large  768x512
1536x1536     1536x1023
sim-card      640x360
alt text saved: Sunset over the sea
html: img tag with width, height, alt and srcset created
cleaned: yes
tidy file names: My-Holiday-Photo-1.JPG | IMG-2026-05-12-final-FINAL.jpeg

The size names such as thumbnail, medium and large are WordPress’s standard sizes, and themes may add their own. When you insert an image into a post, WordPress uses the right copy, and in modern versions also writes a list of sizes so browsers pick the best one for each screen. This is why you should upload an image that is big enough, but not enormous.

Alt text

Alt text is a short written description of an image. Screen readers read it aloud for people who cannot see the picture, and search engines use it to understand the image. It also appears if the picture fails to load. Write it as if describing the picture over the phone: ‘Three-tier chocolate birthday cake with strawberries’. Skip phrases like ‘image of’. If a picture is only decoration, leave the alt text empty on purpose. Do not stuff it with keywords. The test above saved alt text in the library as well.

Featured images

A featured image is the main picture of a post or page. Themes use it on the blog list, at the top of the post and when you share the link on social media. Set it in the sidebar. Keep a consistent shape, for example 16 by 9, so the blog grid looks tidy.

Housekeeping

  • Delete unused media from time to time, and keep the library tidy with clear file names.
  • Never use pictures you do not have the right to use. Use your own, or sources that state a licence you can follow, and credit where required.
  • Do not upload private documents to the media library; files can be reached by anyone who has the link.
  • For large videos, upload to a video service and embed, so your host does not carry the weight.

Practice

Take one of your own photos. Resize it to 1600 pixels wide with any free tool, save it at about 80 percent quality, give it a clear file name and upload it. Add alt text, set it as a featured image on a test post and compare the file size before and after. Then open Media and find the copies WordPress made.

Practice answer

A typical phone photo of several megabytes should drop to a few hundred kilobytes with no clear loss. If the picture looks soft on a large screen, upload a slightly larger version, or check that you did not stretch a small image.

Common mistake

Uploading the original from the camera and letting WordPress shrink it. It keeps the huge original on disk, and some themes still serve it. Resize first.

Check what you learned

Five quick questions. Pick an answer and you will see straight away whether it is right and why.

Why resize an image before uploading?

  1. It changes the alt text
  2. It deletes the original
  3. Smaller files load faster
  4. It adds a caption

Page speed matters.

What is alt text for?

  1. Describing an image for screen readers and search
  2. Naming the file
  3. Setting the size
  4. Adding a link

It helps accessibility.

Which file name is best?

  1. IMG_4412.jpg
  2. chocolate-birthday-cake.jpg
  3. photo 1 (final).JPG
  4. x.jpg

Clear names help you and search engines.

What does WordPress do after you upload an image?

  1. Deletes it
  2. Turns it into a page
  3. Changes the theme
  4. Creates smaller copies for different sizes

Thumbnail, medium and large are standard.

Which format suits a logo with sharp edges?

  1. A low-quality JPEG
  2. PNG
  3. A video
  4. A text file

PNG keeps edges crisp and supports transparency.

Summary

  • Resize and compress before uploading.
  • Use clear file names and meaningful alt text.
  • WordPress creates smaller copies for you.
  • Use pictures you have the right to use.

Next lesson

Next: menus and navigation.

Questions

What is the best image size for a blog post?

A width of about 1200 to 1600 pixels is usual. Check your theme's content width and aim for twice that for sharp screens.

Should I use WebP?

It is often smaller, and modern WordPress supports it. Check your host and your audience's browsers, and keep a JPEG fallback if needed.

Can I compress images inside WordPress?

Plugins can do it automatically at upload. Choose a well-reviewed one, and still resize before uploading.

Progress is saved in this browser.