induwara.lk
induwara.lkImage · Privacy-first

Image Cropper — aspect ratio presets, free in your browser

Trim a JPG, PNG, or WebP image to a 1:1, 4:3, 16:9, 9:16, golden, or free-form rectangle entirely in your browser. Drag the corners, nudge with arrow keys, or type exact pixel coordinates — files never leave your device.

By Induwara AshinsanaUpdated May 11, 2026
Image CropperAspect presets · free-form · in-browser
Files stay on your device

Everything runs in your browser. Nothing is uploaded.

What this does

Loads your image into a canvas and trims it to a rectangle you pick. Choose an aspect-ratio preset (1:1, 16:9, golden, etc.) or free-form. Drag the crop overlay, resize the corners, or type exact pixel coordinates. Aspect ratio stays locked unless you switch to free mode.

Aspect ratio
Output format
Source size
Add an image
Crop size
Area kept
Output bytes
Press Crop to compute
Add an image to start

Drop or pick a JPG, PNG, or WebP file above.

Geometry verified against MDN's canvas docs and Adobe's golden-ratio reference. Cross-checked 2026-05-11. See the "Sources & references" section below.

How it works

Cropping on the web has been a single-call canvas operation since the original HTML5 spec shipped. The tool above wires up the three-step pipeline that every modern browser supports: decode the source file into an HTMLImageElement, copy a sub-rectangle of those pixels into an off-screen canvas with the 9-argument form of drawImage, then encode the canvas back to a file with canvas.toBlob. No part of the file leaves the tab.

The mathematically interesting step is the planning: given a source size and a target aspect ratio, how exactly should the crop rectangle land on the source? The primary formula uses the limiting axis. Compare the source width-to-height ratio with the target ratio:

src_aspect = source_width / source_height
if src_aspect >= target_aspect:
    crop_height = source_height
    crop_width  = round(crop_height * target_aspect)
else:
    crop_width  = source_width
    crop_height = round(crop_width / target_aspect)
crop_x = round((source_width  - crop_width)  / 2)
crop_y = round((source_height - crop_height) / 2)

A second, independent formula solves the same problem from the width-first side: assume the crop spans the entire source width, then shrink to height if the implied height would overflow the source. Both formulas produce the same integer width and height to within 1 px of rounding slack on every input the tool accepts. The Cross-check panel inside the calculator above shows both numbers side by side so you can verify they agree on your own image.

Free-form mode skips the aspect-ratio constraint. The four corner handles each move independently within the source bounds, with a minimum crop size of 8 × 8 px so the rectangle is always visible. When you switch back to an aspect preset, the current rectangle is reshaped around its existing centre so you don't lose your framing.

Encoding uses the same path the Image Resizer tool relies on: canvas.toBlob(callback, mime, quality). JPEG quality is fixed at 0.92 — high enough that re-encoded photos are visually indistinguishable from the source, low enough that the output file isn't larger than the input. PNG and WebP are lossless / near-lossless and ignore the quality argument. The source-rect and destination-rect dimensions in the drawImage call are identical, so no resampling happens — kept pixels reach the encoder unchanged.

Worked examples

Phone photo → 1:1 square (centred max crop)

A 4032 × 3024 phone photo trimmed to a 1:1 Instagram-feed square. The source is wider than the target, so height limits the crop; the rectangle slides horizontally on a stationary vertical axis.

  1. Source: 4,032 × 3,024 · 4:3
  2. Aspect chip: 1:1
  3. Crop rect: 3,024 × 3,024 at (504, 0)
  4. Cross-check (width-first): 3,024 × 3,024 at (504, 0) — agrees with the primary planner.
  5. Output canvas: 3,024 × 3,024 (no resampling)

Full HD landscape → 9:16 vertical (for Reels)

A 1920 × 1080 landscape screenshot trimmed to a 9:16 vertical aspect for a Reel. Height is the unchanged axis; width shrinks to roughly one-third of the source and the rectangle centres horizontally.

  1. Source: 1,920 × 1,080 · 16:9
  2. Aspect chip: 9:16
  3. Crop rect: 608 × 1,080 at (656, 0)
  4. Cross-check (width-first): 608 × 1,080 at (656, 0) — agrees with the primary planner.
  5. Output canvas: 608 × 1,080 (no resampling)

Studio shot → 1.618 golden ratio (editorial cover)

A 3000 × 2000 studio shot trimmed to the golden ratio. The source aspect is narrower than the target, so width limits the crop; the rectangle centres vertically.

  1. Source: 3,000 × 2,000 · 3:2
  2. Aspect chip: golden
  3. Crop rect: 3,000 × 1,854 at (0, 73)
  4. Cross-check (width-first): 3,000 × 1,854 at (0, 73) — agrees with the primary planner.
  5. Output canvas: 3,000 × 1,854 (no resampling)

Aspect ratio presets

Each preset chip on the tool maps to a fixed width-to-height ratio. The right column shows what the maximum centred crop looks like on a 4032 × 3024 phone photo for comparison.

PresetRatioMax crop on 4032 × 3024
1:1 Square1.000 : 13,024 × 3,024 @ (504, 0)
4:3 Classic1.333 : 14,032 × 3,024 @ (0, 0)
3:2 Photo1.500 : 14,032 × 2,688 @ (0, 168)
16:9 Widescreen1.778 : 14,032 × 2,268 @ (0, 378)
9:16 Vertical0.563 : 11,701 × 3,024 @ (1,166, 0)
3:4 Portrait0.750 : 12,268 × 3,024 @ (882, 0)
2:3 Portrait0.667 : 12,016 × 3,024 @ (1,008, 0)
21:9 Ultrawide2.333 : 14,032 × 1,728 @ (0, 648)
1.618 Golden1.618 : 14,032 × 2,492 @ (0, 266)

Frequently asked questions

Sources & references

Canvas behaviour and ratio definitions were last cross-checked against the above sources on 2026-05-11. The page is reviewed twice a year and whenever the Canvas spec changes the toBlob / drawImage contract.

Related tools

Rate this tool
Be the first to rate

Comments & feedback

Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.

Found a bug, edge case, or want to suggest an improvement?

Email me at [email protected] — most fixes ship within 24 hours.