THE IMAGE GUIDEBOOK

How to resize an image to custom width and height

Set exact pixel dimensions, calculate one dimension automatically and choose fit, crop, stretch or padding.

Open Image Resizer ↗

Image resizer

Resizing changes the number of pixels across an image and down its height. It does not simply change the file size in KB. If a website asks for a 1200 × 628 image, enter those values as width and height and choose how the original should fit that shape.

TRY IT HERE

Resize to custom dimensions

Choose your images, adjust the settings and download your results.

Drop your images here

One image or the whole folder’s worth.

JPG, PNG & WebP · Up to 50 MB per image · 100 images
Image processing happens on your device.
Original imageProcessed image
↔
ORIGINALRESULT
Same display size; download to inspect full resolution.

Set a custom image size

  1. Choose your JPG, PNG or WebP images.
  2. Select Custom width and height.
  3. Enter the required width and height in whole pixels. Leave either one blank to calculate it from the original proportions.
  4. Choose the appropriate aspect-ratio option.
  5. Click Resize images, check the output dimensions and download the result.

What if the proportions are different?

A 1600 × 900 photograph is wider than a square. Fitting it inside a 600 × 600 box produces roughly 600 × 338 pixels. That preserves the whole photograph, but it is not an exact 600 × 600 file.

Centre and crop makes an exact square by cutting away the sides. Add padding keeps the complete photograph and fills the empty space above and below it. Stretch also gives exact dimensions, but changes the proportions and can make people or circles look distorted.

Resize a batch carefully

The same settings apply to each image, while automatic dimensions are calculated separately for each original. A portrait and a landscape image will not have the same height when only width is specified. Review the dimensions shown beside every result.

Can I make an image larger?

Custom dimensions allow enlargement, but new pixels do not restore missing detail. Start from the largest original available. For downscaling only, choose Maximum long edge; smaller images remain at their original dimensions.

For a transparent image, keep PNG or WebP output. The quality setting applies to JPG and WebP, while PNG encoding ignores that slider.

HOW IT WORKS

Behind the result

For a 1200 × 800 source in a 600 × 600 box, fit gives 600 × 400. Crop scales to 900 × 600 and trims the sides. Padding keeps 600 × 400 content within a 600 × 600 canvas. Stretch gives 600 × 600 with distorted proportions.

How dimensions are calculated

A decoded image is drawn onto a new canvas. With one dimension blank, the other is calculated from the original aspect ratio. Fit inside uses the smaller of the width and height scale factors; centre crop uses the larger and clips the excess. Stretch uses separate horizontal and vertical scales. Padding keeps the subject proportional and fills the remaining canvas area.

Resampling versus canvas size

Resizing resamples pixels through the browser’s canvas drawing implementation with smoothing enabled. Reducing dimensions removes spatial detail. Enlarging interpolates pixels and cannot recover missing photographic detail. Change canvas size keeps the image at its original pixel size and adds space or clips edges around it. Maximum-long-edge mode only reduces dimensions, while custom dimensions can enlarge.

What does encoding mean?

Decoding turns the bytes in an image file into pixels that a browser can display. Encoding turns pixels back into a file, using the rules of JPG, PNG or WebP. It is not encryption. Our compression and conversion tools decode locally, draw the image onto a canvas and call the browser’s canvas.toBlob encoder. The browser supplies the codec, so results can vary between browsers.

Why size and quality are different

Pixel dimensions describe the image grid; file size measures encoded bytes. A 600 × 600 image has 360,000 pixels, but its byte size depends on format, visual complexity and quality. PNG preserves transparency; JPG requires an opaque background.

Where processing happens

Your selected image is processed on your device, without an image upload. Canvas exports are new files and may change embedded metadata or colour information. Keep a master copy for archival work. Animated PNG and animated WebP are rejected; these tools handle static images.

How target-size compression works

Choose 100 KB, 200 KB, 500 KB or a custom decimal-KB limit. For JPG/WebP, the tool tries quality values from your selected maximum down to 10% and refines a successful bracket with a bounded binary search. When you explicitly allow smaller dimensions, it can also try up to eight downsizing steps. PNG ignores quality. Exact resizer dimensions are preserved. Only a measured output within the byte limit is marked Target met; otherwise the smallest tested candidate is marked Above target. This is a bounded search, not proof of a globally optimal result.

Metadata choice

Preserve supported metadata is the default: EXIF dates, camera and GPS fields are copied, with orientation reset after decoding and dimensions updated. PNG text/dates and JPG comments stay within their format. XMP, IPTC and original colour profiles are not transferred; embedded preview links are cleared. Retained metadata is included in target-size measurements. Remove metadata omits source metadata and disables the original-file fallback. Filesystem download dates are separate.

Explore the details: Browser encodingImage formats — MDN

Find your next image fix.

More practical guides, one problem at a time.

Explore more ↗