How to Compress Images for the Web
3 methods — PixelForge, Photoshop, and Python
Uncompressed images slow down websites, inflate storage costs, and hurt Core Web Vitals scores. Here are three ways to compress images in bulk — from the fastest browser tool to a Python script that handles any volume.
Method 1: Using PixelForge (fastest, no software needed)
The quickest option — works in your browser, no Photoshop or code required.
- 1Go to the Bulk Image Compress tool on PixelForge.
- 2Upload your images or a ZIP of images.
- 3Set your target quality level (75–85% is recommended for web JPEG; 70–80% for WebP).
- 4Optionally choose to convert to WebP for even smaller file sizes.
- 5Click Process and download the compressed images as a ZIP.
PixelForge preserves original filenames and folder structure inside the ZIP. The output size is shown before you download.
Method 2: Using Photoshop (Export As / Save for Web)
Best if you need per-image quality control and already have Photoshop.
- 1Open Photoshop and go to File → Scripts → Image Processor.
- 2Select your source folder of images.
- 3Set the output folder and choose your format (JPEG or WebP).
- 4Set the quality slider (75–85 for JPEG).
- 5Click Run to process all images in the folder.
Photoshop's Image Processor is faster than 'Save for Web' when processing batches — it runs without opening each image in the UI.
Method 3: Using Python (Pillow)
Best for large batches or automated pipelines — free and fully scriptable.
- 1Install Pillow: pip install Pillow
- 2Run the script below, adjusting the quality and paths as needed.
python
from PIL import Image
import os
input_dir = "./images"
output_dir = "./compressed"
os.makedirs(output_dir, exist_ok=True)
for filename in os.listdir(input_dir):
if filename.lower().endswith((".jpg", ".jpeg", ".png", ".webp")):
img = Image.open(os.path.join(input_dir, filename))
img.save(
os.path.join(output_dir, filename),
quality=80,
optimize=True,
)
print(f"Compressed {filename}")
print("Done!")Add optimize=True to enable Huffman table optimization for smaller JPEG files at no quality cost.
Frequently asked questions
What is the best image format for web?
WebP is currently the best image format for the web — it offers better compression than JPEG at the same visual quality and supports transparency like PNG. For maximum browser compatibility, JPEG remains a safe fallback.
What quality setting should I use for web images?
For JPEG, 75–85% quality provides an excellent balance of file size and visual quality for web use. For WebP, 70–80% achieves similar results with even smaller files.
Does image compression affect SEO?
Yes — page speed is a Google ranking factor, and large uncompressed images are one of the most common causes of slow page loads. Properly compressed images directly improve Core Web Vitals scores.
How do I compress images in bulk without software?
Use PixelForge. Upload a ZIP of your images, set your quality level, and download a ZIP of compressed images. No software installation required.
Ready to try the fastest method?
Compress JPG, PNG, and WebP images in bulk. Control quality and reduce file sizes without visible loss.
Compress Images — free
Papiral
PixelForge
Tabular