How to Compress JPEG for Websites

You run your site through PageSpeed Insights and the first thing it flags is a hero image that's 3.6 MB. Your Largest Contentful Paint score is in the red, your mobile visitors are bouncing before the page even finishes painting, and Google is quietly docking your ranking for it. Meanwhile the image itself was just a normal photo — nobody intentionally made it slow.

Unlike email, a website doesn't have a hard size ceiling that clips your content — it just gets slower, page by page, image by image, until visitors leave. Every uncompressed JPEG on your site adds real, measurable seconds to load time, and search engines now factor that directly into how — and whether — your pages rank.

Quick Answer

To compress JPEG for websites, resize the image to its actual display width, export at quality 70–80, and strip unnecessary metadata. This usually reduces a multi-megabyte photo to under 150–200 KB with no visible quality loss, while directly improving Largest Contentful Paint and overall Core Web Vitals scores.

What is JPEG compression for websites?

JPEG (Joint Photographic Experts Group) is a lossy image format — every time you save a JPEG at a quality setting below 100, the encoder permanently discards some pixel data using a compression algorithm called DCT (Discrete Cosine Transform). The lower the quality setting, the smaller the file and the more visible the degradation.

For websites specifically, compressing a JPEG well means combining three separate levers — used together, not in isolation:

Combined, these three steps routinely produce 70–90% file size reductions from a raw export — taking a 4 MB photo down to under 200 KB with no visible loss at normal display sizes.

Why image size matters for websites

Oversized images are consistently the largest single contributor to slow page loads on the web, and the consequences extend well beyond "the page feels slow."

📊 Key threshold A widely used target for web JPEGs is under 200 KB per image, with hero or LCP-candidate images ideally under 150 KB. Thumbnails, product grid images, and icons should stay under 50 KB. Total image weight for a full page should generally stay under 1 MB for a healthy Core Web Vitals score on most connection types.

Step-by-step: how to compress JPEG for websites

  1. Determine the actual rendered width of the image. Open your browser's dev tools, inspect the image element, and check its rendered width in CSS pixels — not the file's native resolution. A hero banner that displays at 1200px wide should never be served as a 4000px file, no matter how high-resolution the original camera export is.
  2. Resize the image first, before compressing. In Photoshop: Image → Image Size → set width to the rendered width (or 2× that for Retina/high-DPI screens), resample with Bicubic Sharper. In GIMP: Image → Scale Image. In command line: magick input.jpg -resize 1200x output.jpg. Resizing alone, before touching quality, often cuts file size by 60–80%.
  3. Export or re-save at quality 70–80. In Photoshop: File → Export → Export As → JPEG, set Quality to 75. In GIMP: File → Export As → set quality to 75 in the JPEG options dialog. In command line: magick input.jpg -quality 75 output.jpg. Quality 75 is the standard web sweet spot — small files with no visible degradation on screen.
  4. Strip EXIF and color profile metadata. Photoshop and most cameras embed metadata by default. In Photoshop's Export As dialog, uncheck "Metadata." For command line, ExifTool is the standard: exiftool -all= output.jpg. The Rebrixe JPEG Compressor strips metadata automatically. This typically saves another 5–20 KB per image.
  5. Run a final optimization pass. After resizing and quality reduction, run the result through a dedicated encoder like MozJPEG or jpegoptim, which re-encodes using more efficient Huffman tables without touching the quality number: jpegoptim --max=75 --strip-all output.jpg. This usually squeezes another 5–15% beyond what a standard export tool achieves alone.
  6. Add responsive attributes in your HTML. Use srcset and sizes so browsers request the right resolution per device, and add loading="lazy" to any image below the fold. A perfectly compressed image still wastes bandwidth if it's served at full size to every device regardless of screen width.
  7. Re-test and confirm the final size. Re-run PageSpeed Insights or Lighthouse and check the resulting file size and LCP score. Target under 200 KB for most images, under 150 KB for LCP-candidate hero images. If you're still over target, the most common cause is forgetting step 1 — the image dimensions still exceed the rendered width.
Try the Rebrixe JPEG Compressor — free No uploads, no signup. Runs entirely in your browser.
Compress JPEG Now →

Common mistakes that hurt page speed

1. Compressing without resizing first

The most common mistake on the web: lowering the JPEG quality slider on a 4000px-wide original and wondering why the file is still 700 KB. Quality reduction alone on an oversized image produces a large file at lower quality — the worst of both worlds. Always resize to the actual rendered width before touching the quality setting.

2. Skipping responsive images entirely

A single compressed JPEG served identically to a 4K monitor and a budget Android phone is still wasteful. Without a srcset and sizes attribute, mobile visitors download the same large file desktop visitors do. Responsive images let the browser request a size appropriate to the actual device.

3. Loading every image eagerly

Images below the fold that load eagerly compete with above-the-fold content for bandwidth and delay the metrics that matter most, like LCP. Add loading="lazy" to any image not visible on initial page load, and reserve eager loading for the single LCP candidate image only.

4. Re-compressing an already-compressed JPEG

Every time a JPEG is opened and re-saved at a quality setting below 100, a new layer of compression artifacts stacks on top of the existing ones. A photo saved once at quality 75 looks noticeably better than one saved at quality 90, then reopened and re-saved at quality 75. Always compress from the original high-quality source file.

💡 Pro tip Run your homepage and key landing pages through PageSpeed Insights after every image update, not just once. A single oversized image added later — by a teammate, a CMS upload, or a stock photo swap — can quietly undo months of optimization work.

Real-world compression examples

These results come from applying the full workflow — resize to rendered width, export at quality 75, strip metadata, MozJPEG pass — to common website image types:

Hero Image
Homepage banner
−92%
4.1 MB → 320 KB after resize + compress. No visible quality loss at 1600px.
Blog Photo
Article featured image
−86%
2.2 MB → 290 KB → 140 KB after full workflow. Well under LCP target.
Product Thumbnail
E-commerce grid image
−81%
240 KB → 46 KB. Small images compress dramatically when correctly sized.
Already Compressed
Stock photo download
−24%
Diminishing returns on pre-compressed sources. Use original files where possible.

The pattern holds across nearly every case: resizing to the correct render width does most of the work, and quality reduction finishes the job. Starting from an original high-resolution source consistently achieves 80%+ reduction with no perceptible quality loss on screen.

Tool comparison

The right tool depends on your workflow — browser-based for one-off images, build pipelines or CDN-level automation for sites publishing images at scale.

Tool Type Resizing Metadata strip Privacy Best for
Rebrixe JPEG Compressor Browser Yes Auto Client-side only Quick one-off web image prep, no uploads
Squoosh Browser Yes Manual Client-side only Visual before/after comparison with MozJPEG/AVIF
TinyJPG Browser / API No Yes Server upload Batch compression via API for content teams
jpegoptim (CLI) CLI No --strip-all Local Build pipelines and CI image optimization
Image CDN (Cloudinary, imgix) CDN service Yes, automatic Yes Cloud-hosted Sites needing automatic responsive resizing at scale
ImageOptim (macOS) Desktop app No Yes Local macOS drag-and-drop batch workflows

Compress your website JPEG right now — free

The Rebrixe JPEG Compressor runs entirely in your browser. Your images are never uploaded to a server — resizing, compression, and metadata stripping all happen locally. No account, no file size limit, no watermarks. Set your target width to match the image's rendered size on your page, choose your quality level, and download the result in seconds.

Free JPEG Compressor — no uploads required Client-side only. Your images never leave your device.
Open JPEG Compressor →

Frequently asked questions

Aim for under 200 KB per image for most use cases. Hero or above-the-fold images can go up to around 300 KB if absolutely necessary, but should be the exception rather than the rule. Thumbnails and grid images should stay under 50 KB. Total page image weight should generally stay under 1 MB for a healthy Core Web Vitals score.
Quality 70–80 is the standard range for web JPEGs. At quality 80, photographic images are visually indistinguishable from the original at typical screen viewing distances. Below 65, block artifacts and color banding can become noticeable, especially around text or sharp edges. Above 85, file size grows quickly with very little visible improvement.
No — it generally helps. Page speed and Core Web Vitals, particularly Largest Contentful Paint, are confirmed ranking signals, and oversized images are the most common cause of slow LCP. Compressing JPEGs properly improves load time, which tends to support rankings, as long as visible quality is preserved at the image's actual display size.
AVIF and WebP typically produce 25–50% smaller files than JPEG at equivalent visual quality and are supported by all modern browsers. JPEG remains useful as a universal fallback for older browsers or contexts like email. For most modern websites, serving WebP or AVIF with a JPEG fallback through the <picture> element gives the best balance of size and compatibility.
Compression alone doesn't fix incorrect dimensions, missing lazy-loading, or a missing responsive srcset. A compressed image still served at 3000px wide into a 400px mobile container wastes bandwidth regardless of its quality setting. Pair compression with correct sizing, lazy-loading for below-the-fold images, and responsive attributes for full results.
Compressed, correctly sized images load faster, which directly improves Largest Contentful Paint when the compressed image is the LCP element — often the above-the-fold hero or banner image. Properly sized image containers with explicit width and height attributes also help prevent layout shift while the image loads, improving Cumulative Layout Shift as well.
Either works, but compressing ahead of time — before the image ever reaches your CMS or codebase — gives you full control over quality and avoids relying on a CMS's default (often inconsistent) compression behavior. For sites publishing at scale, an automated image CDN or build-step pipeline is more reliable than manual compression on every upload.

Compress your JPEG for the web in seconds

The Rebrixe JPEG Compressor runs entirely in your browser — no uploads, no account, no file size limits. Resize, compress, and strip metadata in one step. Your images never leave your device.

Launch the JPEG Compressor →
← Back to blogs