1. Code
  2. JavaScript

Best Free and Open-Source JavaScript Photo Galleries

Scroll to top
Read Time: 7 min

Images are an important part of website design. They help us break the monotony of text and provide some information visually to our visitors. While images usually have a supplementary role on many websites, they are the primary content of others. This is true for websites related to photography or event booking, for example.

When you are showcasing your work or products to visitors, you will probably want them to be able to easily go through your photo gallery in a user-friendly manner. Luckily, there are a lot of top free and open-source JavaScript photo galleries out there that you can add to your website.


Numbers might vary from website to website, but smartphones now drive more traffic on the internet than desktops. Therefore, you should consider paying extra attention to the user experience of mobile viewers on your website.

Swiper Photo GallerySwiper Photo GallerySwiper Photo Gallery

The Swiper photo gallery plugin is a great choice for people who want to build a photo gallery exclusively for mobile devices. It is lightweight, modern, and optimized for touch gestures. You can use it for mobile websites as well as native or hybrid mobile apps.

It does not rely on any external libraries like jQuery, but it can also work well alongside them if needed. There is a feature-rich API for navigation, pagination, and parallax effects. You also get full support for RTL layouts as well as multi-row slides.

The quality of this plugin can be ascertained from the fact that it is the default slider for hybrid app frameworks like Framework7 and Ionic. The dedicated demos page on the website does a good job of showcasing all the capabilities of Swiper.


The PhotoSwipe gallery plugin is a modular and framework-independent image gallery plugin for mobile and desktop. The plugin is broken down into smaller-sized modules which can be loaded independently to only include features that you want and reduce the file size.

Photo Swipe GalleryPhoto Swipe GalleryPhoto Swipe Gallery

Browser compatibility has been a primary focus of the plugin, so it works great on a large variety of devices and platforms. This includes older browsers such as IE8 and above, as well as browsers on Android, iOS, and other operating systems.

The photo gallery supports all basic touch gestures like pinching and swiping. For example, you can use vertical swiping to close a gallery and horizontal swiping to navigate between images. You can also add your own custom behavior for single and double tapping on images.

The gallery plugin comes with a lot of optimizations to provide a great user experience, while also conserving resources wherever possible.


The lightGallery plugin is a lightweight, JavaScript-based photo and video lightbox gallery plugin. It also does not have any third-party dependencies to bloat its file size.

The gallery is fully responsive and highly optimized for touch devices. It comes with gesture support like pinch for zooming and swipe for navigation. The integration with the browser history API allows you to provide deep linking in the photo gallery. You can include other elements like videos from YouTube and Vimeo in your gallery, along with iframes.

It comes with hardware-accelerated CSS3 transitions and support for full-screen viewing. There are options available to integrate social media sharing into the gallery. There are plenty of working demos on the website to show you all its features.

Gallery (blueimp)

The blueimp Gallery is an all-in-one solution for creating a touch-enabled and fully responsive image gallery. It comes with a carousel and built-in lightbox. You can also use it to create a video gallery in addition to regular image galleries.

There are a lot of options available for you to customize the appearance and behavior of the gallery. You can add your own classes to different elements to give them unique styling. There are callbacks for different events such as opening and closing the carousel. You can also execute your own code based on events like slide change or slide load.

You can read the detailed documentation to see how to take full advantage of all the features in the gallery plugin.


The Galleria photo gallery library is one of the most feature-rich free photo galleries on our list. Not only does it have all the features that you expect in an image gallery, like responsiveness and broad browser support, but it also offers additional features like multiple themes that offer a different layout based on your needs.

There are currently six themes available in the plugin that are mentioned on the themes page. They all have their own separate JavaScript and CSS files that you need to load. This helps in keeping the core library smaller. One thing that you might not like about the library is that it requires jQuery. However, it won't be a big deal if you are already using jQuery on your website.

The extensive documentation lists everything that you can do with the library in detail. It covers all aspects of the themes, as well as integration with WordPress. You can also extend Galleria to implement your own functionality. There are a lot of initialization options and methods available to give you full control over the behavior of the gallery.

React Image Gallery

The React Image Gallery plugin is a dedicated photo gallery plugin for the React framework. It has all the essential features like mobile swipe gestures, thumbnail navigation, fullscreen support, and the ability to handle RTL layouts.

React Image GalleryReact Image GalleryReact Image Gallery

You can control the behavior of the slider using a bunch of functions to play or pause the slides. You can also jump directly to a specific slide or get an index of the current slide. There are a lot of props available to enable you to fully customize the gallery.

Head over to the demo page and see how the plugin handles changes in browser width, as well as property values like displaying or hiding thumbnails or navigation.


The V-Viewer plugin is an image viewer component for the Vue framework. It is based on a similarly named JavaScript photo gallery library called viewer.js.

Besides the usual functions to go forward and back inside the gallery, the component offers additional features like rotating and scaling images once they have loaded. The viewer instance can handle both static and dynamic galleries. This allows you to create a carousel where you can add or remove images based on other events.

There are two modes for rendering the component: a modal mode and an inline mode. The modal mode comes with additional features such as full-fledged keyboard-based navigation and the ability to open the image gallery with the click of a button. This way, you can avoid rendering any images on the main page if you want.

The demo page on the component website shows all these options in action. You can activate or deactivate them by clicking on the checkboxes.

React Photo Gallery

The React Photo Gallery component allows you to add a responsive, accessible, and customizable gallery to your React project. It will lay out all the images in your gallery in a nice masonry or justified grid. The grid items or images can also be laid out either in rows or columns.

One difference between other photo gallery plugins that we have listed in this post and React Photo Gallery is that it does not come with built-in lightbox integration or a way to navigate through images using a carousel. However, you can use other free components like React Images to integrate this functionality.

React Photo Gallery componentReact Photo Gallery componentReact Photo Gallery component

You can play with the above example to see how the gallery behaves when integrating third-party components. There are other examples on the website that implement some other features.

Final Thoughts

In this post, we have reviewed some of the most popular free and open-source JavaScript photo gallery libraries and plugins that you can start using in your projects right away. Some of them, like Swiper, are built with specific platforms like mobile devices in mind, while others, like Galleria, are more general-purpose. Hopefully, one of the libraries listed here is exactly what you need for your project.

You can also look for other free and open-source gallery libraries on GitHub if none of the options listed here meet all your needs.

Did you find this post useful?
Want a weekly email summary?
Subscribe below and we’ll send you a weekly email summary of all new Code tutorials. Never miss out on learning about the next big thing.
Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.