APNG Loop Count Setter

Rewrites an APNG's acTL loop count directly at the byte level, overwriting just that one 4-byte field and its chunk's CRC-32 trailer, while every other byte in the file (including every frame's compressed pixel data) is copied through unchanged. Runs entirely in your browser. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-26

Overview

Introduction

This tool changes how many times an existing Animated PNG repeats, without touching the animation itself.

Because it edits the file at the byte level rather than decoding and re-encoding every frame, it's fast and preserves the original image data exactly.

What Is APNG Loop Count Setter?

A targeted byte-level editor that locates an APNG's acTL chunk and overwrites its 4-byte num_plays field with a new loop count you choose.

After the change, it recomputes just that chunk's CRC-32 trailer so the file remains a fully valid, spec-compliant APNG.

How APNG Loop Count Setter Works

The tool walks the file's PNG chunk stream looking for the acTL chunk (the one that announces frame count and loop count) and, once found, writes the new loop count directly into its num_plays bytes.

It then recomputes the CRC-32 checksum over that chunk's type and data bytes and writes it into the chunk's trailer, leaving every other chunk in the file — including all compressed frame data — completely untouched.

When To Use APNG Loop Count Setter

Use it when you have an APNG that plays the wrong number of times (or doesn't loop when you want it to) and you don't want to rebuild the whole animation from scratch.

It's also handy for quickly testing how a fixed-count animation compares to an infinitely looping version without re-exporting from an animation tool.

Often used alongside APNG Checker, APNG Player and APNG Creator.

Features

Advantages

  • Much faster than a full decode/re-encode round trip, since only 4 bytes plus one CRC actually change.
  • Preserves every frame's original compressed pixel data exactly, with zero recompression artifacts.
  • Runs entirely client-side; the uploaded file never leaves your device.

Limitations

  • Only changes the loop count metadata — it can't add or remove frames, or fix any other structural issue in the file.
  • Requires a genuine APNG with an existing acTL chunk; it has nothing to edit on a plain, non-animated PNG.

Examples

Make a 5-play animation loop forever

Input

An APNG with acTL num_plays = 5, new loop count 0

Output

The same file, byte-identical except acTL's num_plays field is now 0 and its CRC recomputed

Setting 0 switches the animation from playing exactly 5 times to repeating indefinitely.

Limit an infinite animation to 3 plays

Input

An APNG with acTL num_plays = 0, new loop count 3

Output

The same file with num_plays set to 3

Any positive number caps playback to that exact number of full cycles.

Best Practices & Notes

Best Practices

  • Verify the result afterward with the APNG Checker or Player tool to confirm the new loop count took effect.
  • Use 0 deliberately and sparingly for UI elements like status spinners, since an infinite loop keeps animating (and using CPU) for as long as it's visible.

Developer Notes

The chunk walk, field overwrite, and CRC-32 recomputation are a pure, synchronous function operating on a Uint8Array copy of the input bytes, so it's fully unit-testable without any DOM or async dependency; the component wires it to an explicit Apply button rather than auto-applying on every keystroke of the loop count field.

APNG Loop Count Setter Use Cases

  • Fixing an APNG that was exported with the wrong loop count
  • Converting a fixed-repeat animation into an infinitely looping one (or vice versa)
  • Quickly A/B testing different loop counts on the same animation without re-exporting it

Common Mistakes

  • Expecting this to change anything about the animation's frames or timing — it only ever touches the loop count field.
  • Uploading a plain, non-animated PNG and expecting a loop count to appear; only files that already have an acTL chunk can be edited.

Tips

  • A loop count of 1 is a common choice for one-shot reveal or transition animations that shouldn't repeat.
  • If you also need to change frame timing, use the APNG Speed Changer tool afterward (or first) on the same file.

References

Frequently Asked Questions