Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

How to Create an Image Gallery in WordPress (Step by Step)

An image gallery is one of the best ways to showcase visual content and make your WordPress site more engaging. It lets you add photos in rows and columns, allowing you to display more photos in less space while also making it easier for users to browse them.

Whether you are a photographer, blogger, or business owner, using galleries can help you display images in an organized, professional, and eye-catching way.

Over the years, we have noticed that websites using image galleries tend to attract more traffic and have higher retention rates. Users often spend more time on these sites exploring the galleries, which keeps them engaged longer.

In this article, we will show you how to easily create an image gallery in WordPress that makes your photos look even better.

How to create an image gallery in WordPress

WordPress makes it super easy to add an image to your blog posts and pages. You just need to add the Image block and upload your image.

However, if you add multiple images to your WordPress website, they will appear one after another. This doesn’t look great, and your users will have to scroll a lot to view them all.

Images added with the Image block

Creating a gallery allows you to display images in a grid layout with columns and rows. You can show thumbnails for your pictures, and users can click on them to see the full image.

This way, you can show more photos in less space, and it will look much more professional.

For example, if you are creating a photography website to display your images, then adding a photo gallery allows you to display your work in an aesthetically pleasing way.

Image gallery preview

With WordPress, you can easily create an image gallery using the Gallery block in the Gutenberg block editor.

You can also use WordPress gallery plugins to create even better galleries with more features.

Having said that, let’s see how to easily create an image gallery in WordPress.

For this tutorial, we will be showing two methods to create a gallery, and you can use the links below to jump to the method of your choice:

This method is for creating an image gallery using the WordPress block editor. However, keep in mind that this feature is very basic and does not offer many customization options.

First, you need to open an existing or new post/page where you want to create the gallery from the WordPress admin sidebar.

Once you are there, just click the ‘+’ button in the top left corner of the screen. From here, find and add the Gallery block to the page or post.

Once you have done that, click the ‘Upload’ button to upload new image files from your computer.

However, if you want to upload images from the media library, then you must click the ‘Media Library’ button instead.

Upload images for the gallery

If you click on the ‘Upload’ button, then you can generally upload one photo from the computer at a time.

However, you can select and open multiple images with the Ctrl key held down on your keyboard.

Upload images from the computer

After you have uploaded all the images, you can add captions by clicking on the ‘Add Caption’ icon in the block toolbar at the top of individual images.

You can also add alt text to the images from the block panel on the right.

Add caption for the uploaded image

If you select the ‘Media Library’ button, then you will be able to choose multiple images for your gallery all at once.

As you select images, you can also enter the image alt text, title, and caption from the attachment details panel on the right side.

Once you have added all the images, simply click the ‘Create a new gallery’ button.

Add images for the gallery from the media library

This will direct you to the ‘Edit Gallery’ page in the media library prompt.

From here, you can select individual images and add a caption, title, description, or alt text to them.

Once you are done, simply click the ‘Insert Gallery’ button at the bottom right corner.

Add captions in the Edit gallery page

The image gallery you created will now be added to the WordPress editor.

You can also further customize it by selecting the Gallery block and configuring its settings from the block panel on the right.

For example, you can use the ‘Columns’ slider to decide the number of columns and rows for your galleries.

You can even toggle the ‘Crop Image’ switch to crop the thumbnails for better alignment.

Configure gallery settings in the block panel

From the ‘Link to’ options, you can choose None if you want your users to only view your photo. This option disables the clicking feature for your images.

However, if you select the ‘Media File’ option, then the images will be clickable, and the image file will open when clicked. Similarly, the attachment page will open if you select the ‘Attachment Page’ option.

Once you are happy with the settings, click the ‘Publish’ or ‘Update’ button at the top to store your settings.

Finally, you can visit your WordPress blog to see the image gallery in action.

Image gallery preview

You have now easily created an image gallery for your website. However, you will soon notice that it lacks some essential features.

For example, your images will either not be clickable or open on a new page. If you link your gallery images to the media file or attachment page, then users will have to click on the back button to view the gallery again.

This is not user-friendly and can discourage users from further exploring your website.

Similarly, the gallery’s appearance also depends on the WordPress theme that you are using.

Plus, you can’t organize your galleries into albums, topics, tags, and more. Your gallery is not stored anywhere, and if you need to add the same gallery again, then you will have to recreate it.

If you want to add more professional-looking galleries, you should use the next method.

If you want to create a more functional and aesthetically pleasing image gallery for your WordPress site, then this method is for you.

We will be using the Envira Gallery plugin as it is the best WordPress image gallery plugin on the market.

Envira allows you to easily create fully responsive, beautiful, and modern image galleries in WordPress. It is super fast and comes with many features like a lightbox popup, easy image navigation, a drag-and-drop builder, and professional gallery templates.

Before recommending the plugin, we thoroughly tested it on our demo website and have had excellent results. Envira Gallery is beginner-friendly and responsive, making it a great choice. To learn more, see our Envira Gallery review.

First, you need to install and activate the Envira Gallery plugin. For more details, see our step-by-step guide on how to install a WordPress plugin.

Upon activation, head over to the Envira Gallery » Settings page from the WordPress dashboard to enter your license key.

You can get this key from your account on the Envira Gallery website.

Note: Envira Gallery also has a free plugin that you can use. However, we will be using the pro version for this tutorial to unlock more features.

Add the Envira Gallery license key

After verifying your license key, you can head over to the Envira Gallery » Add New page from the WordPress sidebar to start creating your first gallery.

Once you are there, provide a title for your gallery and then click on the ‘Select files from computer’ button to upload your images.

Creating a New Gallery with Envira Gallery WordPress Plugin

You can also upload images from your WordPress media library by clicking on the ‘Select files from other sources’ button.

Keep in mind that if you use this option, then you can only upload a single image at a time from the media library.

Upon uploading the images, scroll down to the ‘Gallery’ section, where all your photos will now appear.

Images in Envira Gallery Builder

Next, you can click on the pencil icon at the top of each image to open the ‘Edit Metadata’ prompt on the screen.

From here, you will be able to add the caption, status, title, and alternative text for individual images.

Once you are done, don’t forget to click the ‘Save Metadata’ button to save your image captions.

Edit Gallery Image Metadata

Next, you need to click on the ‘Configuration’ tab from the sidebar on the left.

From here, you can change your gallery layout, including the number of columns, image lazy loading, image size, title and caption positioning, margins, heights, thumbnail sizes, image dimensions, and more.

Edit gallery configuration settings

After that, switch to the ‘Lightbox’ tab from the left sidebar and check the ‘Enable Lightbox’ option.

This option will allow users to enlarge images and browse them without leaving the page.

You can leave the other default settings as they are because they work very well for most websites, but you can review the options and change them if you like.

Enable the lightbox

Next, click on the ‘Mobile’ tab to configure your gallery settings for mobile devices.

From here, you can choose image dimensions for mobile devices, enable or disable Lightbox, enable/disable image captions, and more.

Configure settings for gallery

After that, you can review more options like gallery slug and adding custom CSS from the ‘Misc’ section.

Once you are happy with your settings, just click the ‘Publish’ button at the top to store your changes.

Miscellaneous gallery settings

Next, you need to open up a post or page where you want to embed your gallery.

Once you are there, click the ‘+’ button in the top left corner of the screen to open the block menu.

Next, simply find and add the Envira Gallery block to the page or post.

Add the Envira gallery block

Once you have done that, you need to add your image gallery from the dropdown menu in the Envira Gallery block.

Finally, click the ‘Update’ or’ Publish’ button at the top to save your changes.

Now, you can view your image gallery on your WordPress website.

WordPress Photo Gallery Created with Envira Gallery

Here, you will notice that clicking on any image in the gallery will open it in full size with the lightbox effect.

You can also browse images in this popup by pressing the left and right arrow keys on the screen or your keyboard.

Envira Gallery Image in the Lightbox Popup

Bonus: Optimize Gallery Images For Search Engines

It is important to optimize all your gallery images without losing web quality so that search engines can index them for the right keywords.

This can help boost your page loading speed, improve user experience, enhance social media shares, and bring organic traffic to your website.

You can easily optimize your gallery images by adding alt text in the attachment details page. This description is shown to the search engine crawlers and helps your image galleries rank higher.

Add alt text with all your images

Additionally, you can also use All in One SEO, which is the best WordPress SEO plugin on the market.

It comes with an Image SEO addon that will automatically set your alt text, image titles, captions, and more. It will also add a proper image sitemap and other SEO features to improve your SEO ranking.

For more information, see our AIOSEO review.

All in One SEO website

Other than that, you should also use descriptive file names for your images, use relevant keywords, and share your galleries on social media. For more tips, see our beginner’s guide on how to optimize images for search engines.

Video Tutorial

If you learn better with visual aids, then you might want to check out our video tutorial:

Subscribe to WPBeginner

We hope this article helped you learn how to create an image gallery in WordPress. You may also want to see our comparison between WebP vs. PNG vs. JPEG: the best image format for WordPress and our expert picks of the best WordPress plugins for managing images.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us. Here's our editorial process.

Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!

Reader Interactions

150 CommentsLeave a Reply

  1. WPBeginner Staff

    Are you using any other plugins that might cause conflict? Try deactivating all plugins and see if this fixes the problem.

  2. Catrin Siân Lloyd

    Hi I’m a wordpress beginner! My gallery is somehow linked to the homepage…so when clicked the image takes you back to the ‘Home page’ and not to either a lightbox effect or to the image itself. How do I fix this? Catrin

  3. Michele

    Hi, is it possible to add a lightbox gallery like this in a widget area? Thanks-
    Michele

  4. Tyler

    I have a question. I use JQuery plugin for and hovering pin it button. I was wondering if you know of a solution when you click on the photo gallery for carousel mode there is no pin it button. I would I be able to add that button to the gallery?

  5. Diane Lara

    When someone is viewing my gallery of images with minimal captions, when they click on an image, I would like them to see a larger image with additional information about the image beside or below that large image. I don’t want a gallery of images with all of that information destroying the grid aesthetic. Is this possible? I do not know coding or website jargon – sorry.

  6. Imagine That

    This post is so helpful! Many Thanks

  7. Sabrina

    I just have to say, this post is awesome… as all your posts are. You have made me into a better programmer. Thank you for all you do.

  8. Keith Davis

    Hi guys
    Just created my first WordPress gallery and carousel – looks fantastic.

    Just one question, how do I edit the gallery when I work in html mode not visual mode.
    Messed about for half an hour and I can’t figure it out!

  9. Christy

    Thank you SO much for this post. Not only did you save me HOURS of time creating my client’s gallery, you also taught me something new – and I love a good challenge. Your instructions were clear, concise and accurate. You are appreciated!!!

  10. Kailash

    Hi, sayed will it increase the loading time of website ? Beacause i want ot add around 100 photos to my website

    • WPBeginner Support

      Yes, though it is probably not a good idea to add 100 images even if they are thumbnails, on a single page or post.

      Admin

  11. Rita

    This made things so much easier than using a plugin, thanks so much for the article!
    I have a question though: is it possible to get rid of the image titles under the images and only show them in the lightbox view? I would like to see only images on the gallery page.
    Many thanks,
    Rita

  12. Ana Mota

    Thank you so much! You make wordpress very easy for beginners like me. I just have one question:

    I have installed the carousel plugin but I don’t want the “write a comment” area to appear. Is there a way to remove it?

    Thanks again!

  13. James McInally

    Never knew about the carousel plugin for the WP Gallery, so cheers for that, J

  14. Courtney

    Thanks so much for this page – it was definitely helpful. I did have one question: I’m working on a photography website and trying to apply a gallery to a page; however, I don’t seem to have the option of using the scroller format when I do that, only thumbnails. I’m using PhotoPro, which allows me to have a scroller on the homepage, but my client really wants that format (with different photos) on several pages, and carousel isn’t much of a substitute for the scroller. I’ve tried to find information about this through several sources, but I can’t seem to find a solid answer as to whether or not it’s possible.

  15. vaisakh

    tnkz for your post…..it really helped me…

  16. Gale Weithers

    This post was very very helpful! Thanks a mil!

  17. Marci Hess

    Thanks for this info! I have a couple of questions about the gallery that maybe you can help with.
    1) When adding photos, there is an option that I’m unsure about. What is the difference between link to “attachment page or link to “media file”
    2) Sometimes my photos get “cut off” in the gallery but are “full size” when you go the hyperlinked page or if you click on that particular photo. I have changed the settings so the media size is the same as what I’m resizing them to, but that didn’t help. What else can I do?
    Thanks for any help.
    Marci

    • WPBeginner Support

      1. You can choose to link an image to an attachment page, which is a WordPress page with the image displayed in large size, or you can link to media file, which is the actual image file you uploaded.

      2. It looks like cropping is turned on for thumbnail sizes in your WordPress theme. You can turn off cropping to allow WordPress to scale images when resizing them instead of cropping. The problem with this approach is that your images may look disproportionate.

      update_option(“thumbnail_crop”, “0”);

      Admin

  18. Krish Murali Eswar

    God bless you, folks. Sometimes things are so easy in Wordpress. Yet, I miss it. Your site is certainly my first ‘go-to’ site for any wordpress related help.

  19. Robert

    Kudos!! Simple solution for any beginner. Much easier approach that the various lightbox plugin implementations.

  20. Peter

    The images does not show up in IE. Is it a known problem?
    Tested IE10 on win7 and win8, same problem.
    Great article!

    • WPBeginner Support

      We are not aware of any such issue. We were unable to reproduce it in internet explorer.

      Admin

  21. Dave Lampen

    Is it possible to get rid of the comment box under the gallery?

  22. Francesco

    Awesome !
    A question:
    Is it possibile link a gallery ?
    For example:
    PhotoGallery

    Is it possibile ? How ?

    Thanks and excuse me for my bad english

    • WPBeginner Support

      Yes it is possible. Lets say you create a post or a page with a photo gallery in it and you title that page PhotoGallery. It is like any other WordPress post or page and can be linked any where.

      Admin

  23. Karen

    Awesome! so easy! I’ve spent hours…. trying to get a plugin to do this and it was right under my nose all the time!!!! thank youuuuuuuuuuuu

  24. Marie

    Thank you for explaining this so clearly! I really wish I would have found your site 3 days ago…make that 3 years ago.

  25. Santhi Wijaya

    Hi, is there a way to reduce the opacity of the image border? or to remove completely? Thanks

  26. Keith

    Thanks for a great tutorial. I’m wanting to have my gallery on one side of the page and have it open the album in a carousel next to it in another div. How difficult would that be to do?

    Thanks,
    Keith

  27. alex

    Hello and thank you for posting this! Do you have any idea why, when clicking on the photos to view them, they are as small as the thumbnails? Thank you!

  28. Lyman

    This is awesome. Exactly what I needed! Thanks for creating it.

  29. Santhi

    Hi, how come when i change the thumbnail size under Settings > Media, the previously uploaded images with old thumbnail size doesn’t change into the new size? Does this mean i have to re-upload those images?

  30. rachael knight

    Great article, thanks!

    Is it possible to keep the captions displayed on the page, instead of only displaying if the user clicks to display the larger img?

    Many thanks

  31. Annei

    Can i add this feature on my website without installing the plugin. I mean can i add it manually in theme files?

  32. Kristen

    Hi there, When I click on a thumbnail of a gallery in my post, it pulls up the gallery carousel but it is off to one side of my screen, like 2 inches on the left so the photos look scrunched up. Do I have something off on my settings?

  33. Zimbrul

    The plugin is particularly good as it’s responsive, I’ll use it on my sites.
    I’m currently using a premium plugin that adds social share buttons to the image in a lightbox. It’s pretty good.
    One question: if you use the plugin and comment to a photo where the comments shows up? Is like a comment to the article?

    • Keith

      Zimbrul – Which plugin are you using to add social share buttons to the image in lightbox? Do you have an example you can share? I’m looking for this for a project I’m currently working on.

      Thanks,
      Keith

  34. Abhijith V M

    Nice information there. Thanks

  35. Carlin

    Good stuff…better than WP’s support pages!

    • Editorial Staff

      We don’t provide support for WordPress.com sites. This site is built for those who are using the self-hosted WordPress.

      Admin

  36. savannah

    Hi!
    When I’m using the Visual Editor I can’t see the box in post edit area indicating that there is gallery code.It used to be there, but something is changed!
    Need to know how to fix this!
    Sanna

    • Editorial Staff

      Did you add a new plugin? Because the only thing we can think of with the information provided is that there is a plugin conflict.

      Admin

      • Savannah

        Thanks for the reply!
        If I have added a plugin am I not aware of that I did. How can I check if there is any plugin that I should remove??
        / Savannah

  37. Nemo

    Great post! I’ve just been having fun choosing which great gallery mode to have on my blog – the ‘Circles’ option is stunning!! Really professional looking. I had no idea WP had this.

    Thanks for posting this HowTo! ;)))))))))))))

  38. joseph

    Hello! I THINK this post might be able to help me, but at this point in the day, I am feeling pretty dumb, so… who knows? I have been trying to install a simple slideshow on my Wordpress.com blog all afternoon. Literally for the past 5 hours. I have read 8 million supporting pieces, but every time I preview it, I see small thumbnails that open to slightly larger images. If I click on THOSE images, they open into large, individual pictures. I know there is a way to just go straight to large images. I just cannot figure it out. Please, someone, help!

    thanks so much in advance.

    • Editorial Staff

      WordPress.com and self-hosted blogs are different. But WP.com does have a carousel feature that you need to enable.

      Admin

  39. Doc4

    Thank you for this post. I had no idea WordPress even had this fetaure and I’ve been using it for years. I was using the NextGen Galley but this is perfect for a small project I’m working on. Very helpful.

  40. Abdul Rahim

    Very nice and easy tutorial.
    I aslo use this plugin to create photo gallery.

  41. Susan

    Hi, When using the Carousel without Jetpack plugin (which works very well, thank you for that!) can you have just one large image on your webpage, which when clicked, opens the carousel gallery as it does in Facebook? I want my webpage to not be a gallery of all the pictures, but rather one image larger.
    Any thoughts?
    Thanks!

    • Editorial Staff

      You should use a lightbox plugin for that instead of a carousel. Or you can use the carousel and only add one image in the gallery.

      Admin

      • Susan

        Thanks. I’ll give that a try.

        • Susan

          Thanks again, adding the one image plus the Carousel worked VERY well for me:
          myimmortals.com

  42. Afro Arena

    Thank you very much for your article. With this, I was able to create a beautiful gallery

  43. Willem

    Hi, I wonder what to do about the empty tags being created before and after the gallery. Can you help me out with this?

    Kind regards,

    Willem

  44. Abbey

    Hey,
    I followed your instructions for a site I’m working on but it doesn’t seem to work.
    The images are not displayed in a carousel even though the plugin is installed and activated.

    Any ideas please?

    • Editorial Staff

      It is possible that you have another plugin activated that is conflicting with the carousel plugin. Can you please send us an email with your site url, so we can take a look.

      Admin

  45. Tanja

    Thank you so much for this! I just made a gallery, it is going to be a visual recipe index for my food blog. Is there a way to add a link to the recipe, when the picture is clicked?

    • Editorial Staff

      Not unless you manually add that image outside of the gallery and hyperlink it.

      Admin

  46. Pamela

    Thank you for this! I was looking for a plugin to make a gallery, I didn’t know you could do this on wordpress directly, I just made a gallery for an article and it looks really good! <3

  47. Rob van den Brand

    Great post, I’ll probably replace NextGen with this option now.

  48. Amar

    How about using nextgen gallery plugin for the same ?

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.