Pixels, aspect ratios, and the five fit modes
An image resizer changes an image’s pixel dimensions — the number of pixels wide and tall — by resampling the original into a new grid, either preserving the aspect ratio or forcing the image into a target shape.
Resizing is the single highest-leverage image optimisation there is, and it is routinely skipped. A modern phone camera produces images around 4000 pixels wide; the column they are displayed in is often 800. Serving the full-size file means the browser downloads roughly twenty-five times the pixel data it will ever draw, then spends CPU time discarding most of it.
It is also the step where images get quietly ruined — stretched avatars, cropped heads in social cards, logos scaled up into a blur. This page covers the five fit modes, the presets, and the one rule about scaling up that is worth internalising.
The five fit modes and what each one does
Direct answer: give width or height alone and the other dimension is calculated to preserve the aspect ratio. Give both and the fit mode decides what happens to the difference. These descriptions match what this tool actually returns.
- Contain (default)
- Fits the whole image inside the target box without cropping. The output canvas is always the exact width × height you set; empty space is filled with white for JPEG (no alpha) and with transparency for PNG and WebP.
- Cover
- Fills the box completely and crops the overflow, keeping the aspect ratio of what remains. The output is exactly the size you asked for. Right for banners and social cards where the frame is fixed.
- Fill
- Forces the exact dimensions and stretches the image if the ratio does not match. Almost always a mistake outside of deliberate effects.
- Inside
- Scales the image as large as possible while staying within both limits, and returns that smaller (or equal) size — so a 3000×2000 photo into a 1080×1080 box comes back as 1080×720, not a padded square.
- Outside
- Scales until both sides meet or exceed the box, and returns that larger size — so the same photo into 1080×1080 comes back as 1620×1080. You then crop elsewhere if you need an exact frame.
- Single dimension
- Entering only a width (or only a height) preserves the ratio exactly. Limits are 1–10,000 pixels per side; uploads are capped at 10 MB.
- Orientation and metadata
- EXIF orientation is applied before resizing, so phone photos that look sideways in the file come out upright. Camera EXIF and GPS are stripped from the result and are not kept on the server.
- Built-in presets
- Ready-made dimensions for common platform formats — stories and video at 1080×1920, Pinterest pins at 1000×1500, marketplace gig images and more — so you are not looking up specifications while you work.
What happens when the ratio does not match
One source image, one target box, three very different results. This is the decision the fit mode is making for you.
Example 1: A landscape photo into a square frame
Source: 3000 × 2000 (3:2 landscape)
Target: 1080 × 1080 (square)Contain → 1080 × 1080 canvas, image 1080 × 720 centred, white (JPEG) or transparent (PNG) padding
Cover → 1080 × 1080, sides cropped away
Fill → 1080 × 1080, image squashed
Inside → 1080 × 720 (no padding)
Outside → 1620 × 1080 (larger than the box)These sizes were produced by running this tool on a 3000×2000 test photo. Cover is right for a social square when the subject is centred. Contain keeps everything but pads the canvas; Inside keeps everything and returns the smaller size with no padding.
Example 2: Preparing a 2× retina asset
Displayed at 600 px wide
High-density screens need 2×Width: 1200 px
Height: leave blankLeaving the height blank keeps the ratio exact. Doubling the display width is enough for essentially every current device; 3× rarely justifies the extra bytes.
Example 3: The upscaling problem
Source: 400 × 300 logo
Target: 1600 × 1200Soft, blurred edges.
No detail is recovered.Resampling can only interpolate between pixels that already exist. Scaling up invents nothing. For logos and icons, get an SVG or a larger original — no resizer can fix this.
Sizes worth targeting
Platform specifications change, so treat these as starting points and verify against the platform’s current guidance for anything commercially important.
| Purpose | Common dimensions | Notes |
|---|---|---|
| Blog body image | 1200 × 675 (16:9) | Wide enough for most content columns at 2× on a phone. |
| Open Graph / social share card | 1200 × 630 | The near-universal default. Keep text away from the edges — platforms crop differently. |
| Vertical story or short-form video cover | 1080 × 1920 (9:16) | Leave clear space top and bottom for platform interface overlays. |
| Pinterest pin | 1000 × 1500 (2:3) | Taller pins get cropped in the feed. |
| Profile avatar | 400 × 400 | Square. It will be displayed as a circle almost everywhere, so keep the subject centred. |
| Ecommerce product photo | 1600 × 1600 | Square, generous size for zoom on the product page. |
Preview a share card before it goes live with the meta tag generator so you see the crop the platform will actually apply.
Common resizing mistakes
Resizing in HTML or CSS instead of the file
Setting width="800" on a 4000-pixel image still downloads the full file. The browser scales it for display only — you get all of the bytes and none of the benefit.
Cropping faces out of social cards
Different platforms crop the same image differently. Keep the important content within the middle 80% of the frame.
Losing transparency
Resizing keeps the same format, so a transparent PNG stays transparent (Contain pads with transparent pixels). JPEG has no alpha, so Contain pads with white instead. Format conversion is what flattens transparency — mind the order if you also plan to convert the file.
Resizing after compressing
Compressing then resizing throws away the work: the artefacts introduced by compression get resampled along with everything else. Resize first, compress second.
Expecting the Inside option to never enlarge
Inside only constrains the image to stay within the box; a small source into a large box is still enlarged to fill that box as much as the ratio allows. Upscaling invents no detail — get a larger original or an SVG for logos.
Sources and further reading
Where the technical statements on this page come from: standards, specifications and the official documentation of the tools and services involved.
- web.dev: Serve responsive images — why images should be sized for the space they are displayed in, including high-density screens
How this page is maintained
The five fit modes, padding colours, single-dimension behaviour, 1–10,000 pixel limits, 10 MB upload cap, EXIF orientation handling and metadata stripping were checked against this tool’s server code and measured on test images. Platform dimensions are starting points and should be checked against each platform’s current specification before a commercial campaign.
Written and reviewed by the ToolsRacks editorial team. Last reviewed: . Found an error? Tell us — see our editorial standards.