To add a background to a PNG in Photoshop, place a solid color fill layer underneath the transparent cutout and flatten the image so every transparent pixel takes the fill color and every semi-transparent pixel blends with it according to its alpha value. The same compositing logic applies to any browser-based alternative that processes the alpha channel against one solid color and exports a new opaque PNG at the original width and height. The result is not a simple "delete transparency" mask — it is a real source-over composite, where partly transparent edges blend smoothly with the new backdrop instead of leaving a hard halo. Once you understand that rule, you can decide whether the built-in Photoshop path or a local browser tool is the faster route for the specific PNG in front of you — a logo, a product cutout, a signature, an icon, or a screenshot with stray transparency around its edges.

What "adding a background" actually means for a PNG
A PNG with an alpha channel stores, for every pixel, a color and an opacity. A pixel can be fully visible, fully invisible, or somewhere in between. The phrase "add a background" really means "composite every pixel over one solid color and write the result as an opaque PNG." That distinction matters because a PNG cannot have a "background color" the way a JPEG can — transparency is the absence of a color, not a default value the viewer fills in for you.
The rule Photoshop, browser tools, and any image editor all rely on is source-over alpha compositing. For each pixel, the result RGB is computed as:
- result_RGB = source_RGB × source_alpha + background_RGB × (1 − source_alpha)
- result_alpha = 255 (fully opaque)
A fully transparent pixel has alpha = 0, so the formula reduces to result = background. A fully opaque pixel has alpha = 1, so the formula reduces to result = source. Everything in between is a weighted blend. The W3C Compositing and Blending specification defines this formula exactly, and the MDN canvas compositing reference shows how browsers implement it inside an HTML canvas. This is the model you should hold in your head when you see "replace transparency with color" in any tool, including Photoshop and any browser-based replacement.
The Photoshop way to add a background to a PNG
Photoshop gives you full control, but the steps are specific. Use this exact sequence when your goal is a single opaque PNG with one solid background color.
- Open the transparent PNG with File > Open. Photoshop detects the alpha channel and keeps it intact on its own layer.
- In the Layers panel, click "Create a new layer" (the square-with-plus icon). Rename it "Background" or leave the default "Layer 1".
- Drag the new layer below the PNG layer in the Layers panel so it sits behind the cutout, not in front of it.
- Press Ctrl/Cmd+Backspace to fill the new layer with the current background color, or open Edit > Fill, choose "Color…", and pick the exact destination color (for example, #FFFFFF for white).
- If your document still shows a checkerboard at the bottom, convert the filled layer to a real background with Layer > New > Background from Layer so the structure matches a normal opaque document.
- Flatten with Layer > Flatten Image so you have one opaque layer ready to export.
- Export with File > Export > Export As…, choose PNG, and confirm. The PNG you download will have alpha = 255 everywhere and the chosen color showing through every formerly transparent or partly transparent area.
If you prefer a non-destructive workflow, use Layer > New Fill Layer > Solid Color instead of a plain pixel layer. The fill layer sits beneath the PNG, can be edited at any time to change the background color, and is flattened only at export. The same alpha-compositing math happens under the hood whether you fill with white, brand red, or a specific print color. A soft drop shadow under a logo that was originally over a checkerboard becomes a faint reddish shadow when you composite it against a red fill — that is correct behavior, not a bug.
How to add a background to a PNG in your browser
If you do not need Photoshop's editing tools and just want one opaque PNG with the right solid background, a browser tool can do the same alpha composite without launching an editor. The Add Background to PNG tool runs entirely in your current tab: nothing is uploaded, nothing leaves your machine, and the source file is never modified.
- Choose a transparent or partly transparent PNG up to 25 MiB from your local device.
- Select the solid background color that matches the final destination, using the browser color control.
- Click "Add background" to composite every pixel of the source against the chosen color and set the output alpha to 255.
- Inspect the opaque preview and confirm the on-page dimensions match the original width and height exactly.
- Download the PNG. The filename automatically adds "-background" so the new file stays easy to distinguish from your transparent source.
The tool accepts PNG only, and that is by design. JPEG does not carry an alpha channel, so there is no transparency to replace. Other browser-decodable formats can carry alpha inconsistently across applications, which would make the output less predictable. Keeping the input contract narrow means the browser decodes one PNG, composites every pixel over one color, and exports one PNG — predictable every time.
What every pixel type does during the composite
The table below summarizes how each kind of source pixel is treated. None of these rows are computed on the page — they are the defined behavior of source-over compositing with an opaque backdrop, exactly as the W3C spec describes.
| Source pixel state | Output pixel after compositing |
|---|---|
| Fully transparent (alpha = 0) | Exactly the selected background color, channel for channel |
| Partly transparent (0 < alpha < 255) | Blend of source RGB and background RGB, weighted by alpha |
| Half-transparent (alpha ≈ 128) | Approximately equal mixture of source and background colors |
| Fully opaque (alpha = 255) | Original source RGB, unchanged |
| Any alpha value | Output alpha set to 255 (fully opaque PNG) |
This is why a transparent PNG of a logo with soft anti-aliased edges and a faint drop shadow looks clean when composited against the destination color, and why it can look wrong when composited against the wrong color. The shadow pixels have low alpha, so the chosen background color contributes most of the result, and a hard background mismatch shows up immediately as a visible halo.
A worked example: a half-transparent red pixel over a blue fill
Take one source pixel: red, RGB (255, 0, 0), at alpha 128 — roughly half-transparent. The selected background is blue, RGB (0, 0, 255), at opaque alpha 255. Apply the source-over formula from the W3C spec, with source_alpha = 128/255 and (1 − source_alpha) = 127/255:
- Result R = 255 × (128/255) + 0 × (127/255) = 128 + 0 = 128
- Result G = 0 × (128/255) + 0 × (127/255) = 0 + 0 = 0
- Result B = 0 × (128/255) + 255 × (127/255) = 0 + 127 = 127
The final pixel rounds to RGB (128, 0, 127) — a dark purple. A half-transparent red over blue mixes toward purple rather than toward pure red or pure blue. The browser tool applies this same formula pixel by pixel and then writes alpha = 255 across the entire output. Photoshop produces the identical result for the same input pair during its flatten step.
Limits, file sizes, and what the tool will not do
The Add Background to PNG tool has specific guards so the browser does not crash on very large decoded canvases. Files up to 25 MiB are accepted before decoding. After decoding, the working canvas is capped at 16 megapixels and at 12,000 pixels on either edge. A file with a .png extension but invalid bytes produces a clear decode error rather than a silent failure.
The tool does not crop, resize, sharpen, denoise, or re-compress the image. The output canvas uses the exact source width and height. If you need different dimensions, add the background first and then use the Image Resizer as a separate step. If the destination wants JPEG instead of PNG, download the opaque PNG and run it through PNG to JPG. Keeping each operation separate prevents a background change from silently altering geometry or lossy quality, so you always know which step changed the file size, which step changed the format, and which step changed the dimensions.
Choosing the right background color for the real destination
Pick the color for the actual destination, not for the checkerboard preview. White (#FFFFFF) is common for marketplaces, documents, and product listings, but social graphics, dark interfaces, print layouts, and brand systems often need a specific hex value. If you do not know the exact hex, the Image Color Picker can grab a known background color from a reference image by clicking a pixel. After download, inspect soft edges against the destination color at normal viewing size — if the edges look right in the destination, the composite is correct.
The tool produces a technically defined composite. It does not certify brand compliance, print color matching, marketplace acceptance, or accessibility contrast. Those checks happen after the file is exported, against the actual destination. For confidential drafts and private product images, the local-browser approach is well suited because the file never leaves your device, though you should still follow your organization's local-device policies.
Related reading: Add a Solid Border to a JPG, PNG, or WebP Image.