Trim Images Online

Automatically detect and remove empty pixels from image edges. Minimize image dimensions by trimming transparent or solid color borders.

What Trim Image Does

Trim Image scans your picture's pixels from each of the four edges toward the center and finds where the uniform border stops and the actual subject begins. In Transparent mode it reads the alpha channel and walks inward, row by row and column by column, until it reaches a pixel that isn't fully transparent. In Background Color mode it compares every edge pixel's RGB value against a reference color — either sampled automatically with Auto-detect or set manually via Color to trim — and keeps walking inward as long as pixels stay within the Tolerance you've set, from 0 (only an exact color match counts as border) up to 255 (almost any color is treated as border). Once the scan stops on all four sides, those boundary lines define a bounding box, the canvas is cropped to it, and any Padding you've set is added back as margin on every side. What it won't do: clean up a border that isn't actually uniform. A gradient backdrop, a soft drop shadow, or JPEG compression noise near the edge won't collapse into one clean trimmed line — you'll get a partial trim or none at all depending on how high you push Tolerance. Edge Connected mode changes what counts as trimmable background in Background Color mode: instead of matching any pixel in the image against the reference color, it only removes background-colored pixels that are contiguously connected to the outer edge, so a patch of the same color sitting inside the subject — a highlight, an accent, a hole in the design — doesn't get chewed into by mistake. Everything here runs by reading canvas pixel data directly in your browser; the trim calculation itself never leaves your device.

Why Trim Matters

Product photos exported from a studio setup or a marketplace template often carry inconsistent margins — one shot has an inch of white space on the left, the next has almost none, and stacking them into a catalog grid produces uneven-looking thumbnails even though every canvas is the same size. Trim removes that inconsistency by cropping each image to its actual content instead of making you eyeball a marquee selection file by file. Game and app icon assets exported from design tools frequently bake in transparent padding — the real artwork is 96x96 sitting inside a 128x128 canvas. That extra alpha margin throws off sprite atlases, misaligns pixel-perfect anchor points, and wastes texture memory at scale; trimming to the alpha bounding box fixes the asset without touching the artwork itself. Screenshots captured with window chrome, browser toolbars, or a solid desktop background around the real content need the same cleanup before they go into documentation or a support ticket — Background Color mode with a sampled edge color strips that frame in one pass instead of a manual crop. Scanned stickers, logos, or line art saved on a plain white or flat-color canvas benefit the same way: trimming reduces the file to its real footprint before it's dropped into a layout or layered in another editor, and Edge Connected mode keeps that safe even when the artwork itself contains shapes that match the background color.

Tight bounding box without manual marquee cropping
Consistent framing across photos with uneven margins
Smaller PNG dimensions for sprites, icons, and stickers
Edge Connected mode protects internal shapes that match the border color

How to Trim an Image

Trimming is a detection pass followed by a single crop, so most of the work is picking the right settings before you apply it.

1

Pick a Detection Mode: Transparent for PNGs with alpha-channel edges, or Background Color for flat-color borders on any format.

2

In Background Color mode, click Auto-detect to sample the border color or set Color to trim manually, then adjust Tolerance until the preview outline hugs the subject.

3

Set Padding if you want a small margin left after trimming instead of a flush crop, and turn on Edge Connected if the subject contains areas matching the border color that shouldn't be trimmed.

4

If the border isn't a flat color at all, toggle Remove background before trimming first, then apply to crop the canvas to the detected bounding box.

Frequently Asked Questions

Crop asks you to draw or drag the boundary yourself; Trim calculates it automatically by detecting where the uniform border ends and the subject begins. Use Crop when you want to remove part of the actual image content or change the aspect ratio, and use Trim when you just want to strip away empty transparent or solid-colored margins without touching the subject. You can chain them, too — trim first to get a tight bounding box, then crop afterward if you still need a specific aspect ratio.
The trim calculation reads pixel data straight from the canvas in your browser and never sends the file to a server. Detection Mode, Tolerance, Padding, and the crop itself are all computed locally, so the image stays on your device for as long as you're just trimming it.
Tolerance sets how far a pixel's color can differ from the reference border color and still count as background, on a scale from 0 to 255. At 0, only an exact match gets trimmed, which works well for a clean, noise-free PNG background. Raising it lets slightly varied pixels — JPEG compression artifacts, anti-aliased edges, faint gradients — get absorbed into the trim, but push it too far and it can start cutting into the subject if any of its colors sit close to the border color.
It struggles with borders that aren't actually uniform — a soft drop shadow, a gradient backdrop, or heavy compression noise near the edge trims partially or not at all depending on Tolerance. If the subject shares a color close to the border's, a high Tolerance can eat into it, which is why it's worth checking the preview outline before applying rather than defaulting to a maxed-out Tolerance.
Without it, Background Color mode matches any pixel against the reference color, wherever it appears in the image. Edge Connected restricts that to background-colored pixels that are contiguously connected to the outer edge of the canvas, so a patch inside the subject that happens to share the border color — a highlight, an accent shape, a hole in the design — is left alone instead of being treated as trimmable background.
Yes, but only in Background Color mode — Transparent mode relies on an alpha channel, and JPEG doesn't have one, so it has nothing to detect. Switch to Background Color, sample the border with Auto-detect or set Color to trim manually, and nudge Tolerance up slightly to absorb JPEG compression noise near the edge.
It runs this site's background removal on the image first, turning the surrounding area transparent, then trims to that new transparent bounding box in Transparent mode — useful when your source border isn't a flat color that Background Color mode can match cleanly. Background removal is a separate feature from the trim calculation itself, so check that tool's own page if you need to know exactly how it processes the image.
Padding adds a fixed margin, in pixels, back onto every side of the trimmed bounding box, so instead of a crop flush against the subject you get a small uniform border again. Set it to 0 for the tightest possible crop, or a few pixels if a completely flush edge looks too tight for a UI icon or thumbnail slot.

More Image Tools

Explore other powerful tools for your image editing needs