PNG Padding Remover

Uploads a PNG, finds the tightest bounding box around its non-transparent pixels, and crops the canvas down to exactly that box — an automatic "trim" that removes however much (and however unevenly) transparent margin surrounds the content on each side. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-26

Overview

Introduction

This tool automatically trims empty transparent padding from around a PNG's visible content, computed entirely client-side.

It's the equivalent of an image editor's "trim" or "auto-crop to content" command.

What Is PNG Padding Remover?

An auto-trim tool that scans every pixel's alpha channel to find the tightest rectangle containing all non-transparent content, then crops the canvas down to exactly that rectangle.

Unlike removing a fixed-thickness border, it adapts to however much margin actually surrounds the content on each side.

How PNG Padding Remover Works

The tool first locates the minimum and maximum x/y coordinates among all pixels with nonzero alpha, forming a bounding box.

It then crops the image to that exact box, discarding any fully transparent margin outside it while preserving every visible pixel untouched.

When To Use PNG Padding Remover

Use it to clean up an exported icon or logo that has more transparent margin baked in than you want.

It's also useful before measuring or comparing an image's true visible dimensions, independent of how much empty space surrounds it.

Features

Advantages

  • Runs entirely client-side; your image never leaves the browser.
  • Adapts to uneven margins automatically instead of assuming a fixed, symmetric border.
  • Leaves every visible pixel completely untouched — only the transparent margin is removed.

Limitations

  • It only detects fully transparent margin; a solid-color (opaque) background isn't recognized as "padding" to trim.
  • A fully transparent image has no content to trim to, so the tool reports an error rather than guessing.

Examples

Trim an icon exported with extra margin

Input

A 512x512 PNG icon whose actual artwork only fills the center 300x280 area

Output

A 300x280 PNG containing just the visible artwork, tightly cropped

The tool finds the exact bounding box of the non-transparent pixels and crops to it.

No-op on a fully-filled image

Input

A 100x100 PNG with visible content touching every edge

Output

The same 100x100 PNG, unchanged

Since the content's bounding box already equals the full canvas, there's nothing to trim.

Best Practices & Notes

Best Practices

  • Run this before measuring an image's true content dimensions, since exported assets often carry extra invisible margin.
  • Check the transparency checker tool first if you're unsure whether an image has trimmable margin.

Developer Notes

This tool's lib function composes two existing pure lib functions — the outline finder (to compute the bounding box) and the cropper (to cut to it) — rather than re-deriving either; both operate on a plain Uint8ClampedArray pixel buffer with no DOM dependency.

PNG Padding Remover Use Cases

  • Cleaning up an exported icon with excess transparent margin
  • Preparing tightly-cropped assets for a sprite sheet
  • Measuring an image's true visible content size

Common Mistakes

  • Expecting this to trim a solid white or colored background — it only removes fully transparent (alpha 0) margin.
  • Running it on a fully transparent image and expecting a valid (rather than an error) result.

Tips

  • Pair this with the padding adder tool to standardize margins: trim first, then add back a consistent amount.
  • Use the transparency checker tool afterward to confirm how much of the canvas is now visible content.

References

Frequently Asked Questions