Introduction
ICNS is the icon format of macOS. An
application bundle keeps its icon as an .icns file, holding the same picture
at sizes from 16 to 1024 pixels square, including double resolution versions for Retina
screens. Finder and the Dock pick the size they need.
Developers usually make one from a folder of PNG files named by size, an
.iconset, using Apple’s iconutil command or Xcode.
Drop an .icns file on this page to see every element it holds, each size as
a picture, and the runs of its compressed data. Nothing is uploaded.
What is documented
Apple does not publish a specification of this file format. Apple documents the
.iconset folder and its file names, and the iconutil tool that
converts between the two. The element types, their sizes and layouts, the compression and
the palettes described on these pages come from independent work: the
libicns library, the
icnsutil project and its
survey of the icons in macOS releases,
and Pillow’s reader. Where these sources disagree,
the pages say so.
The layouts were checked for this reference against 1,935 different .icns
files found on a Mac running macOS 27, with Apple’s own sips command as the
reference for how each kind of element is drawn.
Structure
An ICNS file starts with the four letters icns and the total file length,
a 4-byte big-endian number. The rest is a list of elements, each a four-character type, a
4-byte length that includes this 8-byte element header, and the data.
0Magic the four lettersicns4 bytes4File length big-endian, these 8 bytes included4 bytes8Elements each a type, a length and the datavaries
The type says what the element holds:
| Group | Types | Data |
|---|---|---|
| PNG or JPEG 2000 | ic07 to ic14, icp4, icp5, icp6, icsB, sb24, SB24 | A complete PNG or JPEG 2000 file |
| ARGB | ic04, ic05, icsb | ARGB and four run-length encoded channels, or a PNG or JPEG 2000 file |
| 24-bit | is32, il32, ih32, it32 | Three run-length encoded channels |
| 8-bit masks | s8mk, l8mk, h8mk, t8mk | One byte a pixel, for the 24-bit type of the same size |
| Indexed | icm4, icm8, ics4, ics8, icl4, icl8, ich4, ich8 | 4 or 8 bits a pixel, indexes into Apple’s standard palettes |
| 1-bit | ICON, ICN#, icm#, ics#, ich# | One bit a pixel, and a 1-bit mask except in ICON |
| Nested sets | sbtp, slct, FD D9 2F A8 | Another set of elements: template, selected and dark-mode icons |
| Other | TOC , icnV, name, info | A table of contents, a version, a name and a property list |
Reference pages
- Header and elements – the file header and element layout, byte by byte, and the
TOC,icnV,nameandinfoelements - Element types – every known type, with its size, density and storage
- Run-length encoding – channels, packets and how the encoding differs from PackBits
- 1-bit, indexed and mask elements – the oldest types, the masks, and Apple’s standard palettes
- PNG and JPEG 2000 elements – elements that hold a complete image file
- Nested icon sets – dark-mode, template and selected sets
- Iconset folders – the
.iconsetfile names andiconutil
Not described
Apple does not publish a specification of the icns format. These pages follow Apple’s documentation of icon sizes, the libicns library and independent surveys, and the explorer reads every element it knows.
Unknown
- Reference: why the four bytes before an
it32’s channels exist; they are normally zero, and readers differ on other values (see run-length encoding). - Reference: what the nested
sbtp(template) andslct(selected) icon sets are used for (nested sets), and any order Apple intends for elements. - Reference: Apple’s standard palettes come from libicns, not from Apple.
Links
Software
- Preview – Apple’s built-in image viewer, which opens ICNS (macOS)
- Xcode – Apple’s developer tools; the
iconutilcommand turns an.iconsetfolder into ICNS (macOS) - GIMP – free image editor that opens and exports ICNS (Windows, macOS, Linux)
- XnView MP – image viewer and converter (Windows, macOS, Linux)
Developers
Reference
- Optimizing for High Resolution – Apple’s guide to
.iconsetfolders andiconutil - icns-archive – survey of the icon types used across macOS releases
- Apple Icon Image format – Wikipedia’s summary of the element types