Image Resize
Short answer
Add w for width or h for height to the image URL, for example ?w=250, and Sirv creates that size instantly. Use a percentage such as ?w=50% to scale by proportion. With both w and h, the image fits inside both sizes and keeps its shape, unless you set scale.option to fill or ignore.
After reading this you will know
- How to set the width or height in the URL
- How to scale an image by a percentage
- How fit, fill, ignore and noup change the result
- Which width to serve for cards, articles and heroes
- How to build a responsive srcset from one image
Add ?w= or ?h= to any Sirv image URL and Sirv resizes it on the fly.
The new image is created the moment it’s requested and cached, and your original file stays unchanged, so you never prepare separate sizes yourself.
Use scale.option to choose how the image fits the width and height you set. Try it in the demo below and watch the pixel size and file size change.
Which resize parameters can I use?
Section titled “Which resize parameters can I use?”Add parameters to the end of the URL after a ? and join them with &.
| Parameter | What it does | Example |
|---|---|---|
| w or scale.width | Width in pixels or as a percentage of the original | ?w=250, ?w=50% |
| h or scale.height | Height in pixels or as a percentage of the original | ?h=100 |
| scale.option=fit | Default. Fits the image inside both w and h, keeping the aspect ratio | ?w=150&h=150 |
| scale.option=fill | Scales to the greater of w or h, so the image fills the area | ?w=350&h=120&scale.option=fill |
| scale.option=ignore | Stretches to the exact w and h, ignoring the aspect ratio | ?w=100&h=200&scale.option=ignore |
| scale.option=noup | Never scales the image larger than its original size | ?w=800&h=600&scale.option=noup |
The examples below all use the same 400 × 252px JPEG, so you can compare the results. See every other parameter in dynamic imaging.
Width is changed by appending the w parameter to the URL (or scale.width). The JPEG image below was 400px width. It has been scaled to 250px width:
https://demo.sirv.com/looks.jpg?w=250

Height
Section titled “Height”Height is changed by appending the h parameter to the URL (or scale.height), for example this 100px height image:
https://demo.sirv.com/looks.jpg?h=100

Percentage sizes
Section titled “Percentage sizes”Images can also be scaled as a percentage of their original size. This image has 50% of its original width:
https://demo.sirv.com/looks.jpg?w=50%

Images can be stretched larger, beyond their original dimensions, though images become blurred when they are scaled up.
We recommend uploading your largest images (at least 2500px wide if possible), so they can be scaled down to size.
Width and height together
Section titled “Width and height together”If you specify both w and h, the new image fits inside the two dimensions and keeps the original aspect ratio.
In the example below, w and h are both set to 150px, so Sirv created an image 150px wide and 94px high (because the original image is wider than it is tall):
https://demo.sirv.com/looks.jpg?h=150

Scale options
Section titled “Scale options”scale.option controls how Sirv scales images when you set both dimensions. It defaults to fit, which scales the image to within whichever is the lesser of w or h.
Change it to fill to scale an image to whichever is the greater of w or h (to fill a particular area). The example below disregards the height of 120px and creates an image of 350px width:
https://demo.sirv.com/looks.jpg

Want the image cut to an exact box instead? Combine resizing with cropping.
ignore
Section titled “ignore”To stretch the image, changing the aspect ratio, set the scale.option parameter to ignore (ignore aspect ratio). For example:
https://demo.sirv.com/looks.jpg

Avoid this for product and editorial images unless you want the distortion.
To prevent the image from being scaled larger than its original size, set the scale.option to noup (no upscaling of image).
The example below sets a size of 800px width and 600px height but the image served doesn’t go beyond its original 400px width and 252px height:
https://demo.sirv.com/looks.jpg

This is useful when page templates ask for large image slots but some of your originals are smaller.
What size should I serve on my web pages?
Section titled “What size should I serve on my web pages?”Pick the width from the space the image fills on the page, not from the original file. A product card that shows at 360px wide should not download a 2400px original.
Right-sized images load faster, use less data transfer and still look sharp.
| Page use | Typical displayed width | Sirv URL example |
|---|---|---|
| Small thumbnail | 120–240px | ?w=200 |
| Product card | 300–500px | ?w=400 |
| Blog or help article image | 700–1100px | ?w=900 |
| Full-width desktop hero | 1400–2000px | ?w=1800&scale.option=noup |
High-density (retina) screens need a 2x size. Use retina images or let responsive images pick the size for you, instead of sending one oversized image to every device.
How do I build a responsive srcset with Sirv?
Section titled “How do I build a responsive srcset with Sirv?”Because every size is just a URL, you can build a srcset without creating any files. The browser picks the best width for the screen:
<img src="https://demo.sirv.com/looks.jpg?w=400" srcset="https://demo.sirv.com/looks.jpg?w=200 200w, https://demo.sirv.com/looks.jpg?w=400 400w" sizes="(max-width: 400px) 50vw, 400px" width="400" height="252" alt="Model in a jacket" loading="lazy">Add scale.option=noup to your largest size if the original might be smaller than you ask for.
Can I set quality and format in the same URL?
Section titled “Can I set quality and format in the same URL?”Yes. Resize first and add quality in the same URL, for example ?w=900&q=82. Sirv already serves the best format for each browser by default: AVIF where supported, otherwise WebP.
For more control, see format and quality and the JPEG quality comparison.
When is resizing not enough?
Section titled “When is resizing not enough?”Resizing keeps the whole image visible. Use crop when you need a fixed aspect ratio or want to focus on one part of the image, and thumbnail for square thumbnails.
