How to speed up your Magento 2 store and increase performance
There are multiple ways to optimize your Magento 2 store for speed and performance. Ideally, combine as many of the items below as possible.
Note: If you’re using our Pearl Theme for Magento 2, see this companion guide: How to speed up your Magento 2 store with the Pearl Theme.
1) Enable All Magento Caches
Path: System → Cache Management → Select All → Enable → Submit

2) Enable GZIP Compression (Apache)
Edit the .htaccess file in your web root and add the following.
(Shown as plain text—copy/paste as-is.)
## Enable Apache file compression
SetOutputFilter DEFLATE
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
Header append Vary User-Agent env=!dont-vary
Enable far-future Expires headers:
ExpiresActive On
ExpiresDefault "access plus 1 year"
Disable ETags in clustered setups:
FileETag none
Dynamic content (PHP) alternative: create a .user.ini in your document root with:
zlib.output_compression = on
ℹ️ Note: Some LiteSpeed environments ignore the Apache .htaccess directives above.3) Enable CSS/JS Minification & Merging
Path: Stores → Configuration → Advanced → Developer → JavaScript Settings / CSS Settings

Tip: Test before/after with WebPageTest. JS bundling can sometimes increase Start Render or DOM Content Loaded times.
4) Move JS to Bottom, Preload CSS & Use Advanced Bundling
The Magento 2 Speed Optimization & Advanced JS Bundling module helps by:
- Implementing optimized bundles
- Moving JS to page bottom
- Preloading critical CSS
Case study: Disable unused Pearl modules & enable Advanced JS Bundling.
5) Optimize Images
- Use web-sized assets (e.g.,
1920×1080for hero banners, not5760×3240). - Compress losslessly with tools like TinyPNG or WebSitePlanet.
- Many CDNs auto-compress images.
6) Enable Flat Categories & Products
Path: Stores → Configuration → Catalog → Catalog → Storefront

7) Switch to Production Mode
Run:
php bin/magento deploy:mode:set production
Reference: How to set Magento 2 Developer and Production Mode via SSH
Enable Backend Caching (Redis/Memcached)
Use Redis or Memcached per your host’s Magento-optimized setup.
More: Choosing the right Magento 2 hosting.
9) Use Varnish Cache
Preferred over the built-in full-page cache:
10) Lazy-Load Images
Use WeltPixel Lazy Load (free) to load images as they enter the viewport.
11) Use a CDN
CDNs improve speed, security and bandwidth efficiency. Example provider: Section.io (with Varnish integration).
12) Prefer HTTP/2 (over HTTPS)
HTTP/2 allows multiplexed, parallel requests over one connection. Ensure:
- Your site is served over HTTPS
- Your host supports HTTP/2


13) Keep Magento & Extensions Updated
Regular updates include performance and security fixes.
- Check the Pearl Theme change log.
- Confirm 3rd-party extension compatibility before upgrading.
14) Avoid Extension Conflicts
Multiple vendors can introduce class rewrite conflicts that hurt performance.
WeltPixel extensions include a debugger to highlight rewrites:

If conflicts are hard to resolve, consider the Pearl Theme, which bundles 10+ compatible extensions (GTM, Quick View, Banner Slider, etc.).
Related Resources
- Improve Magento store speed: Disable unused Pearl Theme extensions
- How to speed up your Magento 2 store with the Pearl Theme
Updated on: 17/09/2025
Thank you!
