Transparent PNG Turned Black, White or Haloed — An Accident Report
"My transparent PNG has a black background" is not one bug. It is at least six different bugs that happen to produce the same sentence in a support ticket. The file may be fine and the viewer may be lying; the alpha may have been discarded during a save; the RGB values under the transparent pixels may be wrong even though the alpha is correct; or an entirely different program may have re-encoded the file on the way to your screen.
This is an accident report, not a definition of alpha channels. We built one specimen with a deliberately soft, feathered edge — the kind of edge that exposes every one of these failures — and pushed it through the paths people actually use: an image viewer, a word processor, a format converter, a chat app, a Base64 round-trip and a corner-radius operation. Then we classified the results by looking at the edge first, because the edge tells you which layer broke.

The specimen and why a soft edge matters
A hard-edged circle hides premultiplication errors: every pixel is either fully opaque or fully transparent, so wrong RGB values under fully transparent pixels never show. Our specimen is a solid blue disc whose alpha falls off gradually over about 14 px. That gradient is the diagnostic instrument. If the RGB under the semi-transparent ring is wrong, the ring turns dark or muddy. If it is flattened, the gradient becomes a hard step against a solid field. You can download it as piccalc-soft-alpha.png and repeat everything below.
We also used the solid specimen logo for the corner-radius case, where a hard edge is actually the thing under test.
Failure 1 — the viewer, not the file
Several viewers draw "transparent" as white, some as black, some as a checkerboard, and some as the application's theme colour. A file opened in a viewer that paints a black canvas looks exactly like a file whose alpha was destroyed, but the bytes are untouched.
How to tell: open the same file in two different programs, or paste it into a browser on a page with a coloured background. If the background follows the program, the file is fine. This is the single most common false alarm, and it is worth ruling out before you touch the image.
Failure 2 — alpha discarded by a format that cannot hold it
JPEG has no alpha channel. Saving a transparent PNG as JPEG must flatten it onto something, and different encoders choose different fill colours: black, white, or the pixel RGB values that happened to sit under the transparent area (often garbage). That is where "transparent PNG turned black in Word" usually comes from — not from Word rendering, but from the export step that produced a JPEG.
The same thing happens with some image/bmp writers, with older GIF exports that keep only a 1-bit transparency flag, and with PDF pipelines that rasterise onto a white page. How to tell: check the file's actual format and its channel count, not its name. A .png extension on JPEG bytes is more common than people expect, and browsers sniff content rather than trusting the extension.
Fix with this site: open Convert Format, keep PNG (or WebP with alpha) as the output, and re-export. Do not round-trip through JPEG on the way.

Failure 3 — palette PNG and the 1-bit tRNS chunk
An indexed (palette) PNG can carry transparency only through a tRNS chunk, which is effectively one transparent palette entry. A feathered edge with 200 distinct alpha levels cannot be represented; quantisation collapses it into a hard, jagged boundary. The result looks like a white or dark fringe with stair-steps, not a smooth fade.
How to tell: the edge is jagged rather than smooth, and the image has a small colour count. Re-saving as RGBA PNG fixes it; re-saving as palette PNG again does not.
This one is easy to misdiagnose as "bad anti-aliasing". It is a colour-mode limitation, not an anti-aliasing setting.
Failure 4 — premultiplied alpha and the dark halo
This is the interesting one, and the reason the specimen has a soft edge.
In straight (unassociated) alpha, a pixel stores its true colour and its opacity separately. In premultiplied (associated) alpha, the stored RGB has already been multiplied by alpha. Both are valid representations, but they must be tagged and handled consistently. If a pipeline treats premultiplied RGB as straight — or multiplies twice, or darkens RGB under semi-transparent pixels and then composites onto a light background — the semi-transparent ring picks up a dark fringe. It is not a black background: the interior is fine, and only the transition band is dirty.
How to tell: look at the ring, not the centre. A uniform dark outline that follows the soft edge is premultiplication damage. A solid field behind the whole shape is a flattening problem. Those two fixes are unrelated, which is why generic advice ("re-save as PNG") so often fails.
The maths is simple. For a pixel with straight colour C and alpha a, correct compositing over background B is a·C + (1−a)·B. If the stored C has already been multiplied by a and the compositor multiplies again, the result is a²·C + … — too dark by exactly the amount that shows up as a halo. The bigger the feather, the more pixels are affected.
Fix with this site: re-encode through Convert Format to a fresh RGBA PNG, then check the edge on both a light and a dark page. If the halo persists, the damage is upstream of the file you were given and you need to re-export from the source editor with straight alpha.
Failure 5 — corner-radius and border operations
Adding rounded corners means setting the alpha of the pixels outside the radius to zero. If the tool only sets alpha but leaves the old RGB values, some viewers and some later pipelines will reveal those stale colours as dark triangles in the corners. This is the same class of bug as failure 4, applied to a hard edge.
How to tell: the artefacts are localised to the four corners and are absent on straight edges.
Fix with this site: use Rounded Corners and then re-encode once through Convert Format. Inspect the corners against both black and white. Our 12-cell QA checklist includes this exact check as cell 6.
Failure 6 — transcoding on the way to someone else
Chat apps, CDN image transforms, email clients and "optimise before upload" browser extensions routinely re-encode images. A transparent PNG sent through a pipeline that targets JPEG or a flattened WebP comes out the other end with a solid background. The sender sees the original; the recipient sees the accident.
How to tell: compare the file sizes and formats at both ends. If the received file is a JPEG and the sent file was a PNG, no rendering setting will recover the alpha — it was discarded in transit.
A Base64 round-trip, by contrast, is lossless for alpha: encoding bytes as text and decoding them returns exactly the same PNG, including tRNS and ICC chunks. If a Base64 image appears to have lost transparency, the usual cause is a CSS background on the <img> or a canvas export that flattened it, not the Base64 step. Our Base64 Converter is useful for proving this: encode the specimen, decode it, and compare the two files byte for byte.
The edge-first identification flow
Work down this list in order; it is arranged so that each step is cheaper than the one after it.
- Open in a second viewer on a coloured page. Background follows the program → failure 1, file is fine. Stop here.
- Check the real container and channel count. JPEG / BMP / flattened WebP → failure 2.
- Look at the edge. Solid field behind everything → flattening. Jagged stair-steps → failure 3 (palette). Dark ring only → failure 4 (premultiplication). Dark corners only → failure 5.
- Compare sent and received files. Different format or much smaller → failure 6 (transcoding).
- Only now re-encode. A re-encode before step 1 destroys the evidence and often the alpha along with it.
That order is the whole point of a forensic approach. Most published advice starts at step 5, which is why it fixes some cases and makes others worse.
What each of our tools actually changes
| Tool | What it does to alpha | Use it for | Do not use it for |
|---|---|---|---|
| Convert Format | Re-encodes into a container that can hold alpha | Failures 2, 3, 4, 5 after diagnosis | Recovering an alpha that was discarded upstream |
| Rounded Corners | Writes new alpha at the corners | Failure 5, icon corner masks | Fixing a global dark fringe |
| Compress Image | Re-quantises / re-encodes, may drop ancillary chunks | Reducing size when alpha is already correct | Any case where the edge is already damaged |
| Base64 Converter | Byte-for-byte text round-trip, no pixel change | Proving failure 6 was not the encoding step | Repairing a flattened file |
| Image to PDF | Rasterises onto a page | Print delivery | Preserving transparency for later editing |
| EXIF Viewer & Cleaner | Reads / removes metadata | Cleaning a file before sharing | Anything about pixel data |
One caution about compression: aggressive quantisation can convert an RGBA PNG into a palette PNG and silently reintroduce failure 3. If you compress a soft-edged logo, check the edge afterwards rather than trusting the file size saving.
A concrete repair walkthrough
Take the soft-alpha specimen and deliberately damage it by exporting a JPEG from any editor. Now:
- Open Convert Format, load the damaged JPEG, export PNG. Note that the black field is now baked into the pixels — conversion cannot invent alpha. This demonstrates why step 1 of the flow matters.
- Go back to the original PNG, load it into Rounded Corners, apply a radius, export, and inspect the four corners on a white page and a black page.
- Encode that output with Base64 Converter, decode it, and compare — the edges should be identical, proving the round-trip is innocent.
- Load the original into EXIF Viewer & Cleaner and strip metadata. The alpha is unchanged, which separates "metadata cleaning" from "pixel re-encoding" — two operations people often conflate.
The fourth step connects to the metadata trail, which tracks what survives repeated saves in the other direction: fields rather than pixels.
What we deliberately did not test
We did not test proprietary editor-specific "save for web" presets, because their behaviour changes between versions and would make this report obsolete within a release cycle. We did not test every CDN transform, because the failure class is the same regardless of vendor. And we did not attempt to recover alpha from a flattened JPEG — that is not a repair, it is a re-creation, and it belongs in a different tool.
Files
- Soft-alpha specimen — the feathered edge used for every diagnosis.
- Solid specimen logo — used for corner checks.
- Six-size ICO — see the favicon field test for the transparency behaviour of ICO entries.
Next step: open Convert Format with your own problem file, but run the identification flow first.
<!-- LAB-EXPANSION -->
Appendix I — Byte-level evidence for each failure
Looking at the file header settles several arguments faster than looking at the picture. The soft-alpha specimen is 26,214 bytes; here is what to inspect for each failure class:
| Check | What to look for | Failure it identifies |
|---|---|---|
| First 8 bytes | 89 50 4E 47 0D 0A 1A 0A | A .png name on JPEG bytes — failure 2 |
IHDR colour type | 6 = RGBA, 4 = grey+alpha, 3 = indexed | Indexed with only tRNS — failure 3 |
tRNS chunk present | one palette entry transparent | Hard jagged edge — failure 3 |
iCCP / sRGB chunk | profile tag | Colour shift after re-encode, related to failure 2 |
| Alpha histogram | many distinct alpha values vs two | A feathered edge collapsed to 1-bit — failure 3 |
| RGB under near-zero alpha | should be the true colour, not black | Dark halo — failure 4 |
The last row is the one worth automating. If you read a pixel with alpha 2 and find RGB (0,0,0) where the artwork is blue, a later composite onto white will produce a dark fringe. If instead you find RGB (56,189,248) with alpha 2, the file is straight-alpha correct and the viewer is at fault. No amount of re-encoding fixes the first case if the source editor keeps writing it; you need to re-export from the source.
Appendix J — Alpha capability by container
| Container | Alpha model | Feathered edge | Notes |
|---|---|---|---|
| PNG, colour type 6 | 8- or 16-bit straight alpha | yes | The safe default for exchange |
| PNG, colour type 3 (indexed) | tRNS palette entry | no, effectively 1-bit | Quantisation artefact, failure 3 |
| WebP (lossy / lossless) | 8-bit alpha | yes | Widely supported; check the encoder's alpha flag |
| GIF | 1-bit transparency | no | Hard edges only; not a PNG substitute |
| JPEG | none | impossible | Always flattens, failure 2 |
| ICO with PNG entries | PNG alpha per entry | yes | Since Vista; see the favicon field test |
| AVIF | alpha, encoder-dependent | yes | Verify the specific encoder rather than assuming |
| SVG | painted geometry, no bitmap alpha | n/a | The right choice for mask-icon |
The table is useful because it turns "which format should I use" into a property lookup. If the deliverable needs a feathered edge, JPEG and GIF are excluded before anyone opens an editor.
Appendix K — A ten-line acceptance script
You do not need an image library to catch the two most expensive failures. In a browser, draw the file onto a canvas and read back a few pixels:
const c = document.createElement('canvas');
const x = c.getContext('2d');
x.drawImage(img, 0, 0);
const corner = x.getImageData(0, 0, 1, 1).data;
const edge = x.getImageData(r, 0, 1, 1).data;
// corner[3] === 0 means the corner alpha was written
// a dark edge pixel with alpha > 0 and low RGB suggests failure 4
Run it on a light page and a dark page. A correct file gives alpha = 0 at the corner and a smooth alpha ramp along the feather; a flattened file gives alpha = 255 everywhere; a premultiplied-accident file gives a dark RGB ring where alpha is partial. That is the whole edge-first flow from the main article, expressed as two getImageData calls.
This also explains why Base64 Converter is useful in a diagnosis: a byte-for-byte round-trip leaves every one of those readings unchanged, so any difference you observe after encoding must come from a canvas render or a CSS background, not from the encoding.
Appendix L — What a repair cannot do
Be explicit about the boundary, because it saves time. A re-encode can fix colour-mode limitations, stale RGB under transparent pixels, and container mistakes. It cannot reconstruct alpha that was discarded by an earlier JPEG export, it cannot recover a face that was flattened into the background, and it cannot undo a chat app's re-encode once the recipient has the flattened copy. In those cases the only correct action is to go back to the last file that still had alpha — which is why the identification flow starts by ruling out the viewer before touching anything.
Frequently asked questions
Why does my transparent PNG have a black background in one program and a checkerboard in another?
That is the viewer's canvas colour, not the file. Open it in a second program or on a coloured web page; if the background follows the program, the alpha is intact.
Can I restore transparency after saving as JPEG?
No. JPEG has no alpha channel and the flattening colour is baked into the pixels. Re-export from the original source with alpha, or rebuild the mask.
What causes a thin dark outline around a soft transparent edge?
Usually premultiplied alpha handled as straight alpha, or RGB values darkened under semi-transparent pixels. It is a different bug from a solid black background.
Does converting a PNG to Base64 lose transparency?
No. Base64 is a byte-for-byte text encoding. If transparency disappears, look at the CSS background or a canvas export step instead.
Why do rounded corners show dark triangles?
The corner alpha was set to zero but the underlying RGB was left stale. Re-encode to a clean RGBA PNG and inspect the corners on both light and dark backgrounds.
Files used in this report
- Soft-alpha specimen — A 420 px circle with a deliberately feathered edge
- Solid specimen — For the corner-radius comparison