Broken PNG Fixer

Repairs common structural PNG corruption at the byte level: rewrites a missing or garbled 8-byte file signature (only when a plausible IHDR chunk follows), recomputes and fixes any chunk's incorrect CRC-32 trailer, drops a trailing chunk truncated past the end of the file, and appends a missing IEND chunk. It cannot repair corrupted pixel data inside a damaged IDAT/DEFLATE stream — that would need actual zlib-level stream repair, which is out of scope. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-26

Overview

Introduction

This tool repairs common structural corruption in a PNG file — the kind of damage that happens from a truncated download, a bad copy, or a byte-level editing mistake — right in your browser.

It fixes the file's container structure, not its pixel content: think of it as repairing the packaging, not repainting what's inside.

What Is Broken PNG Fixer?

A byte-level PNG structural repair tool that walks the file's chunk stream, validating and correcting the container-level details every PNG parser depends on.

It fixes four specific classes of structural issue: a garbled file signature, incorrect chunk CRC-32 checksums, a truncated trailing chunk, and a missing terminating IEND chunk.

How Broken PNG Fixer Works

First, it checks the standard 8-byte PNG signature; if it's wrong but a valid-looking 13-byte IHDR chunk immediately follows, the signature is rewritten rather than the file being rejected outright.

It then walks every chunk, recomputing each one's CRC-32 over its type and data and replacing the stored value if it doesn't match, drops any trailing chunk whose declared length runs past the end of the file, and appends a fresh IEND chunk if one was never found.

When To Use Broken PNG Fixer

Use it when a PNG fails to open, shows as broken in an image viewer, or was flagged as invalid by another tool, and you suspect the damage is at the file-structure level rather than in the actual pixel data.

It's also a fast way to double-check and, if needed, clean up PNGs produced by hand-editing tools or partial/interrupted downloads.

Features

Advantages

  • Runs entirely client-side; the uploaded file is never sent to a server.
  • Only rewrites the signature when there's real evidence (a matching IHDR) that the file is genuinely a PNG, avoiding false fixes on non-PNG data.
  • Reports exactly what it fixed, so you know precisely what changed.

Limitations

  • It cannot repair corrupted pixel data inside a damaged IDAT/DEFLATE stream — only the surrounding container structure.
  • A file with no plausible IHDR chunk after its signature is rejected as unrepairable rather than guessed at.

Examples

PNG with a flipped signature byte

Input

A PNG whose first byte was corrupted from 0x89 to 0x88, with an intact IHDR chunk after it

Output

Rewrote the 8-byte PNG file signature. issuesFixed: ["Rewrote the 8-byte PNG file signature."]

The tool trusts the signature rewrite because a valid IHDR chunk confirms this really is PNG data.

Already-valid PNG

Input

A normally exported PNG with correct signature, CRCs, and IEND

Output

wasAlreadyValid: true, issuesFixed: []

No changes are made to a file that already passes every structural check.

Best Practices & Notes

Best Practices

  • Run PNG Validator afterward to confirm the repaired file now passes structural checks.
  • If the image still won't render after repair, the damage is likely inside the compressed pixel data itself, which this tool can't fix.

Developer Notes

The lib function hand-implements a CRC-32 table and checksum (matching the PNG spec's algorithm) and walks the chunk stream with pure byte-array logic: it verifies/rewrites the signature only when a 13-byte-length "IHDR" chunk follows, recomputes each chunk's CRC-32 and replaces mismatches, truncates cleanly at any chunk whose declared length runs past the file's end, and synthesizes a correct IEND chunk if one is missing — deliberately scoped to container-level structure, not DEFLATE stream repair.

Broken PNG Fixer Use Cases

  • Recovering a PNG that was truncated by an interrupted download
  • Fixing a file with corrupted CRC checksums from a faulty transfer or hand-edit
  • Adding a missing IEND chunk to a PNG produced by a buggy export tool

Common Mistakes

  • Expecting this to fix visible garbage/corruption in the actual picture — that's pixel-data damage, which is out of scope.
  • Running this on a file that isn't PNG data at all; without a plausible IHDR chunk, the tool correctly refuses to guess.

Tips

  • Check the issuesFixed list to understand exactly what kind of corruption your file had.
  • Pair this with PNG Validator: run it first to diagnose, then Broken PNG Fixer to repair, then Validator again to confirm.

References

Frequently Asked Questions