How Windows Icons Are Stored in EXE Files

Windows icons are embedded inside an executable’s Portable Executable (PE) .rsrc section as individual RT_ICON bitmap or PNG image frames linked together by an RT_GROUP_ICON directory structure. Windows reads the group directory to select and extract the optimal resolution and color depth variant for rendering across system UI components.
When you view a desktop shortcut or taskbar icon, the graphic displayed is not an external image file on disk. Instead, Windows binaries compile visual branding directly into the executable container. Understanding executable icons requires exploring PE file headers, resource tree hierarchies, and Win32 APIs.
This technical guide explains how Windows binaries structure icon resources, how resolution assets are reassembled into .ico files, and how to extract icons safely using a browser-based parser.
Key Definitions: PE Format, .rsrc, ICO Containers, and Icon Resources
To analyze how Windows binaries store embedded graphics, we must clarify the core system structures involved:
- PE (Portable Executable) File Format: The binary format used by Windows for executables (
.exe), DLLs (.dll), and drivers (.sys). Based on COFF, PE defines how code and data map in memory and on disk. - Resource Section (
.rsrc): A read-only data section in a PE binary structured as a hierarchical directory tree. It holds non-code assets such as icons, cursors, dialog layouts, string tables, version manifests, and bitmaps. - ICO File Container: The standard Windows graphic format (
.ico) designed to encapsulate multiple raster image frames at varying resolutions (16×16, 32×32, 48×48, 256×256 pixels) and color depths (4-bit, 8-bit, 24-bit, 32-bit ARGB) in one container. RT_ICON(Resource Type 3): The binary resource type corresponding to a single raster image frame (a raw DIB header or PNG byte stream) stored within the.rsrctree.RT_GROUP_ICON(Resource Type 14): The directory resource entry acting as the master index for an icon family. It contains metadata descriptors for each icon size and color depth, mapping them to correspondingRT_ICONresource IDs.
Internal Structure of a Windows PE File
Every Windows executable follows a binary layout mandated by the Microsoft PE/COFF specification. The file topology consists of nested headers and section descriptors mapping file offsets into memory:
- MS-DOS Header (
IMAGE_DOS_HEADER): A 64-byte header located at offset0x00starting with signatureMZ(0x5A4D). Fielde_lfanewat offset0x3Cpoints to the PE header offset. - MS-DOS Stub: A legacy 16-bit program displaying
"This program cannot be run in DOS mode"if executed under MS-DOS. - PE Header / NT Headers (
IMAGE_NT_HEADERS): Starts at offsete_lfanewwith signaturePE\0\0(0x00004550). Encapsulates File Header (machine architecture, section counts, timestamp) and Optional Header (entry point, alignment, and Data Directories array where Index 2 points toIMAGE_DIRECTORY_ENTRY_RESOURCE). - Section Table (
IMAGE_SECTION_HEADERArray): Maps virtual memory addresses to physical raw file offsets for sections including.text(code),.data(data),.rdata(read-only data), and.rsrc(resources). - The
.rsrcDirectory Tree: A 3-level hierarchical tree: Level 1 (Resource Type: Type3forRT_ICON, Type14forRT_GROUP_ICON), Level 2 (Resource Name / ID), and Level 3 (Language ID pointing toIMAGE_RESOURCE_DATA_ENTRYwith RVA offset and size).
How Icons Are Stored Inside the .rsrc Section
A PE binary splits icon components into directory headers (RT_GROUP_ICON) and individual image payloads (RT_ICON).
The Disk ICO Header vs. RT_GROUP_ICON Header
On disk, an .ico file begins with a 6-byte ICONDIR header followed by 16-byte ICONDIRENTRY records containing image dimensions, color depth, image size, and a 4-byte dwImageOffset DWORD. Inside a PE binary, the RT_GROUP_ICON resource contains a GRPICONDIR header and 14-byte GRPICONDIRENTRY records. The structure comparison is shown below:
| Field Name | Data Type | Disk ICO Entry (ICONDIRENTRY) | PE Resource Entry (GRPICONDIRENTRY) |
|---|---|---|---|
| Width & Height | BYTE × 2 | Pixel width/height (0 = 256px) | Pixel width/height (0 = 256px) |
| Color Count & Reserved | BYTE × 2 | Palette colors and reserved byte | Palette colors and reserved byte |
| Planes & Bit Count | WORD × 2 | Planes and bits per pixel | Planes and bits per pixel |
| Resource Size | DWORD | Payload size in bytes | Payload size in bytes |
| Identifier / Offset | WORD / DWORD | dwImageOffset (4-byte offset) |
nID (2-byte RT_ICON Resource ID) |
While a disk .ico file uses a 4-byte file pointer (dwImageOffset), the RT_GROUP_ICON structure replaces it with a 2-byte resource ID (nID) matching a child RT_ICON entry in the .rsrc tree.
Reassembling an ICO File from PE Resources
To rebuild a valid .ico file from an EXE binary, an extractor parser executes the following steps:
- Locate the target
RT_GROUP_ICONentry in the Level 2 tree. - Read the
GRPICONDIRheader to determine frame count (idCount). - Iterate through each
GRPICONDIRENTRYrecord in the group directory. - Extract the 2-byte
nIDvalue and navigate to the matchingRT_ICONnode in the.rsrctree. - Read the raw image bytes referenced by the
IMAGE_RESOURCE_DATA_ENTRYof thatRT_ICON. - Construct standard disk
ICONDIRandICONDIRENTRYheaders, converting each 2-bytenIDinto a calculated 4-bytedwImageOffsetpointer. - Concatenate the headers with harvested
RT_ICONbyte streams to output a compliant.icofile.
Icon Resolution, Color Depth, and PNG Compression Standards
Windows desktop environments require applications to render crisp icons across diverse UI contexts and DPI scaling settings (100% to 500%). Consequently, an application main icon group embeds multiple image variants.
Standard Resolution Variants
A complete application icon group packages several standard dimension variants:
- 16×16 pixels: Window title bar, taskbar small icons list, Explorer details view, system tray.
- 24×24 & 20×20 pixels: High-DPI title bar buttons and context menus.
- 32×32 pixels: Explorer list view, desktop shortcuts, taskbar medium icons.
- 48×48 pixels: Explorer large icons view and control panel applets.
- 64×64 & 96×96 pixels: High-DPI display scaling (200% and 300%).
- 256×256 pixels: Explorer Extra Large icons, Jumbo view, Windows Search previews, Start Menu tiles.
Color Depths and Alpha Transparency
Legacy Windows versions relied on 4-bit (16-color) and 8-bit (256-color) palette bitmaps with 1-bit monochrome AND mask transparency. Since Windows XP, binaries use 32-bit ARGB color depth, combining 24 bits of true color with an 8-bit alpha channel providing 256 levels of translucent edge blending.
PNG Compression in 256×256 Icon Resources
An uncompressed 256×256 32-bit ARGB bitmap requires ~256 KB of pixel data. To prevent executable bloat, Microsoft added support in Windows Vista for 256×256 RT_ICON resources to be stored as PNG compressed streams.
When an icon frame is 256×256 pixels, the RT_ICON resource contains a PNG image—starting with the magic signature 89 50 4E 47 0D 0A 1A 0A—rather than a DIB header. This reduces frame footprint from 256 KB down to 10–40 KB. The Windows graphics subsystem (user32.dll and gdiplus.dll) automatically detects the PNG header signature and decompresses the image stream in memory.
How Windows Loads Application Icons via Win32 APIs
When Windows Explorer displays a file listing, the operating system invokes specific Win32 API functions to query and decode icon resources from target binary files:
Primary Win32 Resource and Shell APIs
LoadIconA/LoadIconW: Loads a specified icon resource from an executable module handle (e.g.,IDI_APPLICATION).ExtractIconExA/ExtractIconExW: A Shell API exported byshell32.dllthat extracts arrays of large (32×32) and small (16×16) icon handles (HICON) from `.exe`, `.dll`, or `.ico` files.SHGetFileInfoA/SHGetFileInfoW: The primary Shell API used by Windows Explorer. By specifyingSHGFI_ICONwithSHGFI_LARGEICONorSHGFI_SMALLICON, Explorer retrieves the system image list index and icon handle matching current display DPI and view modes.
Icon Group Precedence Rules
An executable binary can contain dozens of RT_GROUP_ICON directories for documents, toolbars, and settings. Windows Explorer determines which icon group represents the primary application icon by applying a strict numerical rule:
Windows Explorer automatically selects the RT_GROUP_ICON directory with the lowest numeric Resource ID (typically ID 1 or MAINICON) as the main application icon. Software developers assign Resource ID 1 to their primary branding icon in resource scripts (.rc) to ensure consistent Explorer display.
How to Extract High-Resolution ICO and PNG Icons from an EXE Without Running It
Executing an untrusted .exe file just to capture its icon graphic poses severe cybersecurity risks. Malicious binaries can execute background payloads or drop ransomware the moment they are launched on a desktop system.
To pull original high-resolution .ico files and 256×256 PNG graphics out of an executable binary safely without running the program, use a browser-based parser:
- Open the Icon Extractor tool in your web browser.
- Drag and drop your target
.exe,.dll,.cpl, or.sysbinary into the browser interface. - The client-side JavaScript engine reads the file into an
ArrayBuffer, parses the PE.rsrcdirectory tree, and resolves allRT_GROUP_ICONandRT_ICONresources. - Select your target icon group and download the reassembled multi-resolution
.icocontainer or export isolated 256×256 PNG master files directly to your device.
Because extraction runs locally in client-side memory, your executable file is never uploaded to an external server, preserving privacy. For deeper binary analysis, explore the EXE Extractor and our file extraction tools.
Security Benefits of Inspecting EXE Icon Resources
Inspecting the .rsrc directory of executable files provides valuable security analysis capabilities for malware analysts and system administrators:
1. Detecting Malware Icon Spoofing Attacks
Attackers frequently disguise malicious executable payloads as harmless documents (PDFs, Word documents). Cybercriminals attach a PDF icon to an .exe binary named Invoice_2026.pdf.exe, relying on Windows’ default hidden file extension setting to trick users into launching the file.
By inspecting the PE resource tree with an offline parser, analysts expose discrepancies between file extensions, binary headers, and resource entries.
2. Identifying Trojanized Installers
Threat actors regularly copy legitimate icon resources from popular software (such as Google Chrome or Zoom) into trojanized installers. Security tools compare embedded icon hashes and signatures against known binaries to flag impersonation.
3. Forensic Analysis of Hidden Payloads
Malware authors occasionally store payloads or shellcode inside non-standard RT_ICON or custom resource tables in .rsrc to bypass antivirus scanners. Auditing resource sizes reveals hidden anomalies.
Frequently Asked Questions
Where are application icons stored inside a Windows EXE file?
Application icons are stored directly inside the executable’s Portable Executable (PE) .rsrc (resource) section as individual raster image frames (RT_ICON, Resource Type 3) mapped to a group directory header (RT_GROUP_ICON, Resource Type 14).
What is the difference between RT_ICON and RT_GROUP_ICON?
RT_ICON represents an individual raster bitmap or PNG image stream at a specific resolution and color depth. RT_GROUP_ICON is a directory index resource that groups multiple RT_ICON child entries into a single logical icon family and specifies their dimensions and resource IDs.
How does an ICO file container differ from a standard PNG or BMP image?
A standard PNG or BMP file contains a single graphic image at a fixed resolution. An ICO file is a multi-resolution container format that encapsulates multiple image frames at different dimensions (16×16, 32×32, 48×48, 256×256 pixels) and color depths in one file header.
Why do EXE files contain multiple sizes and color depths of the same icon?
Windows displays icons in many UI contexts—including window title bars (16×16), taskbar buttons (32×32), desktop shortcuts (48×48), and Explorer jumbo views (256×256). Embedding multiple sizes ensures the operating system renders crisp graphics without scaling artifacts across different display DPI settings.
Can I extract icons from Windows DLL files like shell32.dll or imageres.dll?
Yes. Dynamic-Link Libraries (.dll) follow the exact same PE binary structure as .exe files and store icons in their .rsrc section. System DLLs like shell32.dll and imageres.dll contain hundreds of standard Windows system icons that can be extracted using an icon parser.
How does Windows Vista and newer compress 256×256 high-resolution icons?
To prevent large icons from ballooning binary file sizes, Windows Vista introduced PNG compression for 256×256 RT_ICON resources. Instead of uncompressed DIB bitmaps, 256×256 icon frames are stored as raw PNG streams starting with the magic header signature 89 50 4E 47, reducing file size by up to 80%.
Is it safe to extract icons from an unknown or untrusted EXE file online?
Yes, provided you use a browser-based parser like the Icon Extractor. Browser-based extraction parses PE binary structures entirely in client-side WebAssembly memory without executing the binary or uploading it to a remote server, eliminating malware execution risks.
Related Reading & Tools
- What’s Inside an MSI File? A Windows Installer Database Explained
- What is File Metadata? Complete Guide to Hidden File Data
- Browser-Based vs. Server-Side File Processing: Security & Privacy Comparison
- Are Online File Converters Safe? Security Risks & Privacy Standards
Sources & References
- Microsoft Corporation. PE and COFF Specification. Microsoft Learn Open Specifications. Available online: https://learn.microsoft.com/en-us/windows/win32/debug/pe-format
- Microsoft Corporation. About Resource Files and Icons. Win32 App Development Documentation. Available online: https://learn.microsoft.com/en-us/windows/win32/menurc/resources
- Microsoft Corporation. Icons in Win32 Applications and ICO Structure Specifications. Win32 Graphic Design Guidelines.
Last updated: 18 September 2026.