Batch Image Compressor

Compress multiple images at once without losing quality.

This free online tool allows you to compress multiple images at once to reduce file size while maintaining visual quality. Simply upload your images, adjust the compression settings, and our tool will optimize them for you.

Your images are processed securely in your browser and are not stored on our servers. No registration or email is required.

Supported formats: JPG, PNG, GIF, WEBP. Maximum 20 files, 10MB per file.
Low compression (better quality) 75% High compression (smaller file)
Removing metadata can significantly reduce file size and protect your privacy.

How to Compress Multiple Images at Once

  1. Click the "Browse" button and select multiple image files (up to 20).
  2. Adjust the compression level using the slider:
    • Lower compression: Better quality but larger file size
    • Higher compression: Smaller file size but may affect quality
  3. Choose whether to strip metadata (recommended for privacy and smaller file size).
  4. Select your preferred output format, or keep the original format of each image.
  5. Click the "Compress Images" button to start the batch process.
  6. Once the images are compressed, you can:
    • Download all compressed images at once
    • View and download individual images
    • See detailed compression statistics for each image

Benefits of Batch Image Compression

Compressing multiple images at once has several advantages:

  • Time-saving: Process all your images in one go instead of individually.
  • Consistency: Apply the same compression settings to all images.
  • Efficiency: Perfect for preparing images for websites, social media, or email attachments.
  • Enhanced privacy: Batch remove personal information like GPS coordinates from multiple photos simultaneously.

For best results, choose the appropriate output format:

  • JPG: Best for photographs and complex images with millions of colors.
  • PNG: Ideal for graphics with transparency or images with text and solid colors.
  • GIF: Good for simple animations and images with few colors.
  • WebP: Modern format that offers better compression than JPG and transparency support like PNG.
// Get image info $image_info = getimagesize($tmp_name); if ($image_info === false) { throw new Exception("Invalid image file. Could not get image dimensions."); } $file_size_before = filesize($tmp_name); $width_original = $image_info[0]; $height_original = $image_info[1]; $mime_type = $image_info['mime']; $original_dimensions = "{$width_original}x{$height_original} pixels"; // Get compression level $compression_level = isset($_POST['compression_level']) ? (int)$_POST['compression_level'] : 75; $strip_metadata = isset($_POST['strip_metadata']) && $_POST['strip_metadata'] === 'on'; // Create image resource based on mime type $source_image = null; switch ($mime_type) { case 'image/jpeg': $source_image = imagecreatefromjpeg($tmp_name); break; case 'image/png': $source_image = imagecreatefrompng($tmp_name); break; case 'image/gif': $source_image = imagecreatefromgif($tmp_name); break; case 'image/webp': $source_image = imagecreatefromwebp($tmp_name); break; default: throw new Exception("Unsupported image format."); } if (!$source_image) { throw new Exception("Failed to create image resource."); } // Strip metadata if requested if ($strip_metadata) { // This is a simple way to strip metadata - we recreate the image $clean_image = imagecreatetruecolor($width_original, $height_original); // Preserve transparency for PNG and GIF if ($mime_type === 'image/png' || $mime_type === 'image/gif') { imagecolortransparent($clean_image, imagecolorallocate($clean_image, 0, 0, 0)); imagealphablending($clean_image, false); imagesavealpha($clean_image, true); } // Copy the image data without metadata imagecopy($clean_image, $source_image, 0, 0, 0, 0, $width_original, $height_original); // Replace source image with clean image imagedestroy($source_image); $source_image = $clean_image; } // Create a temporary file for the compressed image $temp_compressed = tempnam(sys_get_temp_dir(), 'img_'); // Get the output format (maintain original by default) $output_format = isset($_POST['output_format']) ? $_POST['output_format'] : $file_ext; if ($output_format === 'jpeg') $output_format = 'jpg'; // Calculate quality based on compression level // Higher compression level means lower quality $quality = 100 - $compression_level; // Save the compressed image switch ($output_format) { case 'jpg': imagejpeg($source_image, $temp_compressed, $quality); $output_mime = 'image/jpeg'; $output_ext = 'jpg'; break; case 'png': // For PNG, quality is 0-9, with 0 being no compression and 9 being max $png_quality = min(floor($compression_level / 11), 9); imagepng($source_image, $temp_compressed, $png_quality); $output_mime = 'image/png'; $output_ext = 'png'; break; case 'gif': imagegif($source_image, $temp_compressed); $output_mime = 'image/gif'; $output_ext = 'gif'; break; case 'webp': imagewebp($source_image, $temp_compressed, $quality); $output_mime = 'image/webp'; $output_ext = 'webp'; break; default: imagejpeg($source_image, $temp_compressed, $quality); $output_mime = 'image/jpeg'; $output_ext = 'jpg'; } // Get the compressed image content and size $output = file_get_contents($temp_compressed); $file_size_after = filesize($temp_compressed); // Clean up imagedestroy($source_image); @unlink($temp_compressed); $new_dimensions = "{$width_original}x{$height_original} pixels"; // Compression doesn't change dimensions $success = true; } catch (Exception $e) { $error = "Error processing image: " . $e->getMessage(); } } else { $error = "Please upload an image file."; } } // Helper function to format file size function formatFileSize($bytes) { if ($bytes < 1024) { return $bytes . ' B'; } elseif ($bytes < 1048576) { return round($bytes / 1024, 2) . ' KB'; } else { return round($bytes / 1048576, 2) . ' MB'; } } ?>

Image Compressor

Compress your images without losing quality.

This free online tool allows you to compress your images to reduce file size while maintaining visual quality. Simply upload your image, adjust the compression settings, and our tool will optimize it for you.

Your images are processed securely and are not stored on our servers. No registration or email is required.

Supported formats: JPG, PNG, GIF, WEBP. Maximum file size: 10MB
Low compression (better quality) 75% High compression (smaller file)
Removing metadata can significantly reduce file size and protect your privacy.

How to Compress Images Online

  1. Click the "Browse" button and select your image file (JPG, PNG, GIF, WEBP).
  2. Adjust the compression level using the slider:
    • Lower compression: Better quality but larger file size
    • Higher compression: Smaller file size but may affect quality
  3. Choose whether to strip metadata (recommended for privacy and smaller file size).
  4. Select your preferred output format.
  5. Click the "Compress Image" button to start the process.
  6. Once the image is compressed, you can preview the results and download the compressed image.

Benefits of Image Compression

Compressing your images has several advantages:

  • Faster website loading: Smaller image files load more quickly, improving user experience.
  • Reduced bandwidth usage: Smaller files consume less data, important for mobile users and email attachments.
  • Lower storage requirements: Save space on your devices and cloud storage.
  • Better SEO: Faster-loading websites tend to rank higher in search results.
  • Enhanced privacy: Stripping metadata removes personal information like GPS coordinates and camera details.

For best results, choose the appropriate output format:

  • JPG: Best for photographs and complex images with millions of colors.
  • PNG: Ideal for graphics with transparency or images with text and solid colors.
  • GIF: Good for simple animations and images with few colors.
  • WebP: Modern format that offers better compression than JPG and transparency support like PNG.