Skip to content
UniKit

PNG margin adder

Add transparent or coloured margins around a PNG — uniform, per-side or squared off — for e-commerce main images and consistent gutters.

Runs in your browserEvery computation happens in your browser — your data never leaves this device.

Images are processed locally in your browser with Canvas and never uploaded.

Pick an image first (PNG / JPEG / WebP / GIF all work).

Result

No result yet

16px

Result

These are the real numbers from this run — copy them straight out.

Pick an image and the result shows up here.

What this tool does

  • Give e-commerce main images a uniform white border so different aspect ratios look consistent in listings.
  • Give screenshots breathing room: add a transparent margin before dropping them into a doc or deck.
  • Turn a rectangle into a square for avatar or thumbnail slots that require a 1:1 ratio.

Example

Input

A 1×1 pixel [1,2,3,255] with a 1 px margin in #ffffff

Output

Output 3 × 3: the original pixel sits at the centre surrounded by 8 pixels of [255,255,255,255]

Margins are new pixels added around the image; with "transparent margin" they are [0,0,0,0], and "pad to square" additionally fills the short side out to the long side.

Frequently asked questions

How much margin can I add, and what happens if I overdo it?

0–512 px per side, the same on all four sides. The total after padding must stay at or below 16 million pixels: a 4000 × 3000 image plus 512 px becomes 5024 × 4024 (about 20.21 million pixels) and errors out, so shrink the source or lower the margin first.

What is the difference between a transparent margin and a colour?

With "Transparent margin" the new pixels are (0,0,0,0) and the exported PNG only has content in the original area, which suits documents and slide decks; without it the chosen colour (white #ffffff by default) fills the border. The original pixels, alpha included, are copied onto the new canvas untouched.

How does "Pad to square" work?

Beyond the four margins, the short side is filled out to match the long one, and the extra pixels are split between the two sides (an odd leftover pixel goes to the right or bottom). For example 800 × 360 with a 16 px margin is 832 × 392, and padding to square makes it 832 × 832; the result panel reports the actual output size and the number of added pixels.

Keywords:png marginadd padding to imagesquare image

Related tools