Digital and AI · Calculator
Crop or fit: how to change an image’s aspect ratio
Enter the photo size and the aspect ratio you need, and the calculator shows how much is cut off when cropping or how much the margins take up when fitting, and the exact sizes in pixels.
Your data
How we calculate
ratio = width ÷ height (from a ready-made ratio, your own or the exact size of the result)crop: area width = the smaller of (original width; original height × ratio), area height = the smaller of (original height; original width ÷ ratio); rounded to a whole pixel, half uparea offset = ⌊(original − area) × frame position ÷ 100⌋ (rounded down, the extra pixel stays on the opposite side)fit: frame = the larger of the same values; for an exact size, scale = the smaller of (result width ÷ original width; result height ÷ original height), image = original × scale, rounded to a whole number; left or top margin = ⌊margins ÷ 2⌋, the rest on the other sideshare cut off = 1 − area of the region ÷ area of the original; share of margins = 1 − area of the original ÷ area of the frame; both before pixel rounding and always equal for the same ratios
Assumptions
- The image is not stretched: objects in the frame keep their shape.
- Area shares are calculated from the exact geometry, sizes are rounded to a whole pixel.
- The frame position is centred by default; change it if the main subject is off-centre.
Limitations
- The calculator does not process the file: it works out sizes, offsets and shares, and you crop or add margins in your editor using these numbers.
- Recommended sizes for particular social networks and platforms are not set here: they change, so check them in the platform’s help pages.
- Quality after enlarging, compression, colour profile and file size are not assessed. Print sizes and pixel density are worked out by a separate calculator.
Sources
A universal formula with no external constants. Default values are labelled as approximate examples, not verified facts.
Questions and answers
Will the calculator crop my photo itself?
No. It does not open or upload the file; it only works out which area to keep, which pixel it starts at and what margins to add. You enter these numbers in an image editor, in the crop or canvas size fields.
Why are the cropping and margin percentages the same?
Both depend only on two ratios: the original and the new one. The difference is what happens to that share: cropping removes part of the image, fitting adds empty bands and the image stays whole.
Can I change the ratio without cropping and without margins?
Only by stretching the image along one axis, and that distorts objects and faces. There is deliberately no such mode here: cropping or margins are the only ways to keep the right shape.
Why is the result’s ratio slightly different from the one I set?
Pixels can only be whole. For a frame 3,000 px high to have a 16:9 ratio, the width would have to be 5,333.33 px, so the calculator rounds it to 5,333 and shows by what percentage this changes the ratio.
Related tools
The calculator does not change or upload your file; it only works out the sizes. Recommended sizes for social networks and platforms are not set here: they change, so check them in the platform’s help pages.
Checked by the Calc editorial team: three independent implementations of the formula, test cases and the live page on a phone. Last check: 18 October 2026