Crop a transparent PNG to its content
Drop a transparent PNG below and it is cropped to the smallest rectangle that still contains every visible pixel. The transparent border disappears, the alpha channel survives, and the file never leaves your browser.
This page also covers what actually happens inside a PNG — the alpha channel, the difference between PNG-8, PNG-24 and PNG-32, and why each one behaves the way it does when cropped.
Drop image here
or
PNG, WebP or JPG · up to 50 MB · you can also paste from the clipboard
Your images are processed locally in your browser.
What the crop actually reads
A PNG stores up to four channels per pixel: red, green, blue and alpha. Alpha is opacity, from 0 for completely transparent to 255 for completely opaque. Colour channels are irrelevant to cropping — a black logo and a white logo on transparent backgrounds produce exactly the same bounding box, because only alpha decides whether a pixel is there.
Cropping therefore reduces to one question asked of every pixel: is alpha above the threshold? The leftmost, rightmost, topmost and bottommost pixels that answer yes give the four edges of the crop. That is why the operation is exact rather than approximate, and why it needs no guessing about what your background colour might be — the file already says which pixels are nothing.
PNG-8, PNG-24, PNG-32: what changes
“PNG” covers several quite different encodings, and the one you exported affects how the edges of your image look.
| Variant | How transparency is stored | Effect on cropping |
|---|---|---|
| PNG-32 | Truecolour with a full 8-bit alpha channel: 256 levels of opacity per pixel. | The normal case. Soft shadows and antialiased edges are preserved, which is exactly why the threshold control exists. |
| PNG-24 | Truecolour with no alpha channel at all, or a single fully transparent colour key. | With no alpha there is nothing to trim and AutoCrop says so. With a colour key, edges are hard and the box is pixel-exact. |
| PNG-8 | Indexed palette of up to 256 colours, one of which may be marked transparent. Some encoders also store per-index alpha. | Cropping works normally. Edges are usually hard because a palette cannot hold many opacity levels, so the threshold barely matters. |
| Interlaced (Adam7) | Any of the above, stored in progressive passes. | No difference. The browser fully decodes the image before AutoCrop sees a single pixel. |
Antialiasing, shadows and the threshold
A PNG-32 exported from any modern design tool has antialiased edges: the boundary of every shape is a gradient of partly transparent pixels that keeps curves from looking jagged. Those pixels are real content and should be kept, which is why the default threshold is a low alpha > 5 rather than something aggressive.
Drop shadows and outer glows are the same mechanism at a much larger scale. A 30-pixel blur produces a 30-pixel gradient of near-invisible pixels, all of which are technically visible and all of which land inside a correct bounding box. If your cropped icon still looks like it has a margin, that margin is almost always the shadow. Raise the transparency threshold to 40–100 and it will be clipped away — the measured example on the home page shows how much each step removes.
Why exports keep the transparent margin
The tools people export from are not doing anything wrong; they are exporting the frame you asked for. Common cases:
| Source | What it exports | Result |
|---|---|---|
| Figma / Sketch | The bounds of the selected frame, including empty space inside it. | A logo centred in a 512 × 512 frame exports as 512 × 512 with a transparent border. |
| Illustrator | The artboard, unless you use "Use Artboards" off or asset export. | Artwork smaller than the artboard keeps the difference as transparent margin. |
| Canva | The full design canvas. | Any unused canvas becomes transparent margin in a PNG export. |
| Blender / 3D renderers | The configured render resolution. | The rendered object occupies whatever fraction of frame the camera gave it. |
| Icon-set generators | A fixed square per size, artwork inset by a safe-area margin. | The inset is deliberate, so check whether you actually want it trimmed. |
Cropping transparent PNGs: questions
- Does cropping a transparent PNG keep the transparency?
- Yes. The output is a 32-bit PNG with the alpha channel intact, and any padding you add is fully transparent too. Nothing is flattened onto a background colour.
- Will my indexed PNG-8 stay indexed after cropping?
- No. The browser decodes every PNG into full 32-bit RGBA and re-encodes the result the same way, so an indexed PNG-8 comes back as a PNG-32. It looks identical but the file can be larger. Re-quantise with pngquant or ImageOptim afterwards if the smaller palette mattered.
- Why does my PNG have transparent space in the first place?
- Design tools export the whole artboard or the whole selected frame, not the ink inside it. A 512 by 512 icon frame containing a 300 pixel glyph exports as a 512 by 512 PNG with a transparent border, and screen recorders and 3D renderers do much the same on a fixed canvas.
- Can it crop a PNG with a semi-transparent fill?
- Yes. A 30 percent opaque shape has an alpha value of about 77, far above the default threshold of 5, so it is treated as content and kept. Only pixels at or below the threshold count as empty.
- Is there a size limit for PNG files?
- Up to 50 MB per file and 16,384 pixels on either side. Beyond that, browser canvas behaviour becomes unreliable, so AutoCrop refuses the file rather than silently returning a blank image.
Related
- Trim PNGAutoCrop compared with Photoshop, GIMP and ImageMagick trimming.
- Crop transparent WebPWebP alpha specifics, including the halo that lossy alpha leaves.
- Trim in PhotoshopImage > Trim step by step, its shadow problem, and batching it.
- AutoCropThe main tool: detect content bounds and trim the transparent margin.