Gallery block

Go back to the list of Blocks

The Gallery block allows you to easily add multiple photos and automatically arrange them in a gallery. You can control the number of columns and the size of the images in the gallery.

The Gallery block can be added to a page by clicking on the Block Inserter (+) icon and selecting the Gallery block.

Image showing the Quick Inserter with gallery in the search field.
Adding the Gallery block

Alternatively, you can type /gallery and press Enter.

Image of the slash inserter with the gallery block listed.
Adding the Gallery block with /gallery shortcut

Detailed instructions on adding blocks

Block toolbar

Each block has its own block-specific controls that allow you to manipulate the block right in the editor.

For the entire block

The Gallery block has a toolbar for the individual images as well as a toolbar for the entire Gallery block. 

Block editor toolbar showing image tools and formatting options, with a Replace button on the right.
Block editor toolbar showing image tools and formatting options, with a Replace button on the right.

The main options in the Gallery block toolbar are:

  • Transform to
  • Block moving handles
    • Drag and drop
    • Move up and down
  • Change alignment
  • Link
  • Caption
  • Add button
  • More options

Transform to

Block editor ‘Transform to’ menu open, showing options like Columns, Details, Group, and Image.
Block editor ‘Transform to’ menu open, showing options like Columns, Details, Group, and Image.

You can transform or change the block to another block including the Group, Image, and Column blocks.

When you change the block type to the Image block, every image in your gallery will be converted into a single image block.

Block moving handles

Moving a gallery block

The block-moving handles allow you to move the block up and down the editor. Use the six dots icon to drag and drop the Gallery block and place it anywhere on the page. Alternatively, click on the up and down arrows to move the block up or down.

Get more information about moving a block within the editor.

Change alignment

Gallery block alignment and width
  • Align left – Make the block align-center
  • Align center – Make the block alignment centered
  • Align right – Make the block align-right
  • Wide width – Increase the width of the block beyond the content size
  • Full width – Extend the block to cover the full width of the screen.

Wide width and Full width alignment options are only available if they are enabled in your theme.

You can choose link options to apply to all images in your gallery.

Gallery link options.
  • Link images to attachment pages – Selecting this option will link the image to its WordPress media attachment page.
  • This is an informational page about your image, which includes the image, the caption, the image description, and a comment field.
  • Link images to media files – Selecting this option will link the image to the image file in the original size in a new browser window.
  • Enlarge on click – Selecting this option lets visitors open gallery images in a larger view, also known as a lightbox, without leaving the page. Visitors can move forward and backward through the images in the gallery.
  • None: Selecting this option will not link the image to anything.

You can add this by clicking on the caption icon on the block settings toolbar.

Adding a caption to the gallery block
Adding a caption to the Gallery block

Adding images

The Add button in the Gallery block lets you add images to the gallery. You have two options to add images to the Gallery block: Open Media Library and Upload.

Adding images to the gallery block
Adding images to the Gallery block

The Upload option allows you to upload a new image or multiple images to the Gallery block and to your media library. The Media Library option lets you select from previously uploaded images in your Media Library.

You can also drag and drop multiple images at the same time from your explorer or finder window into the Gallery block.

Alternatively, you can open the main inserter panel on the editor and open the media tab. Then, you can drag and drop images from the media library and Openverse into the Gallery block.

More options

These controls give you the option to copy, duplicate, and edit your block as HTML.

Read about these and other settings.

For an individual image

Each image inside a Gallery block is an Image block. When you select an individual image, the toolbar shows Image block controls for that image, such as link, crop, replace, and more. These settings affect only the selected image, not the entire Gallery block.

Individual image block toolbar with the 'Select parent block: Gallery' button in focus

Use the Select parent block: Gallery button in the toolbar to return to the full Gallery block settings. This lets you edit gallery-wide settings, such as columns, image resolution, cropping, and layout.

Note: Some options such as Add text over image or Align may not be present or may not work as expected when an Image block is inside a Gallery block.

Move images

After you add images to the Gallery block, you can change the order of images in the gallery. Click on an image and in the block toolbar use the move left and move right arrow handles or drag/drop button (six dots) to arrange the images as you like.

Learn about additional block settings on the Image block page.

Block settings

Every block has specific options in the editor sidebar in addition to the options found in the block toolbar. If you do not see the sidebar, click on the Settings button next to the Save/Publish button.

Settings button highlighted in the block editor next to the Save button.

The Gallery block settings panel is divided into three tabs – List View, Settings, and Styles.

List View

The List View tab allows you to drag and drop images within the gallery to reorder them. When hovering over an image in List View, click on the More options menu (three dots) for additional block controls like copy, duplicate, hide, delete, and more. 

Learn about the More options menu.

Settings

The Gallery block includes the following settings options:

  • Columns
  • Resolution
  • Crop images to fit
  • Randomize order
  • Open images in a new tab
  • Aspect Ratio
  • Navigation button type
    • Only appears if Enlarge on click is enabled in Link options.
  • Advanced
Gallery block settings including column slider, resolution dropdown, and image controls.

Columns

Use the Columns setting to choose how many columns appear in the gallery.

You can choose 1 to 8 columns, but only up to the number of images in the gallery. For example, a gallery with 4 images can have up to 4 columns. Add more images to use more columns, up to the maximum of 8.

To change the number of columns, either:

  • enter a number in the field
  • use the slider to increase or decrease the number of columns

Resolution

You can also choose the Resolution of your image with options that may include Full Size, Large, Medium and Thumbnail depending on what your theme supports and the size of the originally uploaded image.

Learn more about image size and quality

Crop images to fit

You can select whether or not you’d like all of your images to be cropped in your Gallery block.

This option is useful if you have images of varying sizes and shapes. Cropping them will make the images in each row of the gallery the same size. You can toggle this option on and off to see which way you prefer.

Open images in a new tab

If any Link options are enabled for the gallery, you can choose whether you want images to open in a new browser tab window when the visitor clicks on them.

Randomize order

You can choose to randomize the order of images in the Gallery block.

Note: This setting will display the images in a randomized order on the published page/post. However, in the block editor, the images will appear in the order they were added.

Aspect ratio

The Aspect Ratio setting modifies the aspect ratio for all of the images within the Gallery with the choices in the dropdown list, enabling you to set a consistent aspect ratio.

If  Enlarge on click is enabled in Link options for the Gallery, you can select the following button styles. These are the previous, next, and close buttons that display in the lightbox view to help users navigate your images. 

  • Icon: only icons display
  • Text: only text labels display
  • Both: both icons and text labels display

Advanced settings

The Gallery block provides the following Advanced settings options: HTML Anchor, Additional CSS Class(es), Additional CSS, and Styles.

Learn more about advanced settings

Styles

Color

The Gallery block provides color settings options to change the background for the block

For details, refer to this support article: Color settings overview

Dimensions

The Gallery block provides dimension settings options to add padding and margin.

For details refer to this support article: Dimension settings overview

Border

The Gallery block provides border settings options to add border color, width, and radius.

For details refer to this support article: Border settings overview

Changelog

  • Updated 2026-05-21 (props to @kjoyner @madhudollu @jameskoster @paaljoachim @wildworks @joen @dmsnell)
    • Updated block toolbar and block settings to include new lightbox controls and settings
    • Updated Enlarge on click definition to clarify lightbox effect
    • Updated screenshots and videos for WordPress 7.0
    • Updated Advanced Settings to refer to new advanced settings overview page
    • Added video of List View, moving images, and lightbox navigation controls
  • Updated 2026-03-08 (props to @awetz583 @CalolanC @Leonardus-Nugraha)
    • Removed duplicate content
    • Updated gallery link options
    • Updated block toolbar and settings screenshots
    • Updated settings with randomize feature
  • Updated 2026-02-15
    • Updated toolbar & “transform to” screenshots(@rollybueno)
  • Updated 2025-07-05
    • Added Enlarge on click option of the image
  • Updated 2024-01-16
    • Updated screenshots and content for 6.3
    • Fixed text formatting consistecy
    • Added missing alt text to screenshots
  • Updated 2023-03-29
    • Added the option to clear duotone
    • Added information about the style settings tab
    • Added caption button for Gallery
    • Updated screenshot and Videos for 6.2
    • Added Alt text
  • Updated 2022-12-12
    • Added color settings
  • Updated 2022-11-20
    • Adjusted images for mobile view
    • Added caption for images
    • Removed redundant content
  • Updated 2022-08-21
    • Added 6.0 screenshots and videos.Updated block toolbar with Add button and replace the info with the updated process for adding images to the gallery.Reordered the info to separate for the block toolbar and block sidebar. Adding Dimensions to the block settings with video.Updating the blosk settings for images.
    • Adding details for image customizations with content, screenshots and video.
    • Added ALT tags for images.
  • Updated 2021-12-21
    • Updated all screenshots for 5.9 with higher resolution.
    • Added in a context related to the refactoring.
  • Updated 2021-02-02
    • Updated the 5.5 video with 5.6 gifs
    • Updated all screenshots with 5.6
    • Added details to Advanced block settings options
    • Updated out-of-date contents
  • Updated 2020-10-05
    • Updated the video
  • Updated 2020-09-14
    • Updated 5.5 screenshots
    • Updated Block toolbar new features
    • Updated Block settings new features
  • Updated 2020-06-18
    • Added ‘Link back to blocks’ to the top of the page
  • Updated 2020-04-24
    • Added Drag & Drop multiple images to the Gallery block
    • Added video to change the background color as group block
    • Added updated UI displays for WordPress 5.4
    • Added “More Options” to the Block Toolbar section and updated the existing once to fit other block descriptions.
    • Reorganized the post into 3 sections: How to add gallery and images, Block Toolbar and Block Settings.
    • Converted all reusable blocks to regular blocks.
  • Created 2019-03-07

Was this article helpful? How could it be improved?

First published

Last updated