How do I crop an image to exact pixel dimensions?
Decide where the top-left corner of the area you want sits (its X and Y position in pixels, measured from the image's top-left corner), then how wide and tall the area should be. Enter those four numbers here, choose your image and click Convert. The tool cuts out that rectangle and gives it back in the same format, JPEG for a JPEG and PNG for a PNG.
Precise numbers beat dragging a box when you need the same crop on several images, a crop that matches a required size such as 1080 × 1080, or a result you can describe to someone else exactly.
Steps
- Click Choose File and pick an image.
- Enter X offset and Y offset: how far from the left edge and from the top edge the crop starts. The defaults are 0 and 0, the top-left corner.
- Enter Width and Height of the area to keep. The defaults are 100 × 100.
- Click Convert, check the preview and click Download to save
cropped.jpgorcropped.png.
All values are in the image's real pixels, not the size it appears in the preview. A 4000-pixel-wide photo shown small on screen still needs coordinates up to 4000.
Centering a crop: the formula
To cut a centered area of width w and height h from an image of width W and height H:
- X = (W − w) ÷ 2
- Y = (H − h) ÷ 2
Here is that applied to a 1920 × 1080 screenshot, keeping the full height and trimming the sides:
| Target shape | Width × Height | X | Y |
|---|---|---|---|
| Square, 1:1 | 1080 × 1080 | 420 | 0 |
| 4:5 portrait | 864 × 1080 | 528 | 0 |
| 4:3 | 1440 × 1080 | 240 | 0 |
| 3:2 | 1620 × 1080 | 150 | 0 |
| 9:16 vertical | 608 × 1080 | 656 | 0 |
The 9:16 width works out to 607.5, so it's rounded to 608. All four values must be whole numbers: there are no half pixels to cut along, so a value like 607.5 gets an error asking for a whole number.
How the tool treats unusual values
| What you enter | What happens |
|---|---|
| X or Y left blank | Treated as 0 |
| A negative X or Y | "X offset must be 0 or more pixels." |
| Width or height of 0 or less | "Width must be at least 1 pixel." |
| Width or height left blank | "Enter a width in pixels." |
| Text that isn't a number, in any box | "... must be a number of pixels, e.g. 100." |
| A decimal such as 10.5 | "... must be a whole number of pixels." |
| Width or height that runs past the edge | Trimmed to the edge, no error |
| X at or beyond the image width, or Y at or beyond the height | "The crop area is outside the image bounds", followed by the image's actual size |
| No file chosen | "Choose an image to crop." |
| A file the browser can't decode | "Could not load image." |
The trimming has a handy use. Set X to 300 and the width to something larger than the image, such as 99999, and you get everything from pixel 300 to the right-hand edge, without working out the remaining width yourself.
Finding the coordinates
Most image viewers show the pixel position under your cursor. On Windows, Paint shows it in the status bar, GIMP shows it in the bottom-left corner, and Photoshop has it in the Info panel. Hover over the top-left corner of what you want to keep, note X and Y, then hover over the bottom-right corner and subtract to get width and height.
If you only know the target size (say an avatar must be 400 × 400), it's often easier to crop to the right shape here and then scale with the image resizer. Cropping first and resizing second avoids distorting faces and logos.
Output format and file size
The result keeps the original format where the browser can write it. A JPEG photo is re-saved as a JPEG at 92% quality, which keeps the file small but, like any JPEG save, adds a little compression on top of the original's. A PNG stays a lossless PNG with its transparency intact. A WebP stays WebP in browsers that can encode WebP (Chrome, Edge, Firefox) and becomes PNG in those that can't. GIF, BMP, SVG and other formats come out as PNG. The download name follows the format: cropped.jpg, cropped.png or cropped.webp. To make a file smaller still, use the image compressor, or turn a cropped PNG screenshot into a JPEG with PNG to JPG.
Because the result is redrawn from canvas pixels, EXIF metadata such as camera model and GPS location doesn't come along. That's a useful side effect when you're cropping a phone photo before sharing it.
What it doesn't do
There's no rotation, no aspect-ratio lock, no drag handles and no batch mode. Each crop handles one image and one rectangle. Animated GIFs come out as a single still frame. For simple, exact rectangular cuts, though, typing four numbers is as fast as it gets.
Last updated