What is the DIB file format?
The .dib extension denotes a Device Independent Bitmap, a raster image format developed by Microsoft (in collaboration with IBM for OS/2) that underlies the common .bmp file. Being device independent means the color data is self-describing - the file carries its own palette or bit-depth metadata so the image displays consistently regardless of the output device's capabilities.
On disk, a .dib file is structurally identical to a .bmp file: a 14-byte BITMAPFILEHEADER (starting with the two-byte signature BM) is followed by a DIB header variant, an optional color palette, and a raw pixel array. The most common header is the 40-byte BITMAPINFOHEADER introduced with Windows 3.0 in 1990. Pixel rows are stored bottom-up by default, padded to 4-byte boundaries. Supported color depths range from 1-bit monochrome to 32-bit RGBA (the alpha channel requires BITMAPV4HEADER or BITMAPV5HEADER).
In Windows GDI programming, the term DIB refers specifically to the in-memory data structure (BITMAPINFO + pixel bits), while .bmp is the disk-file form that prepends an additional 14-byte file header. The .dib extension on disk is rare and fully interchangeable with .bmp - every application that opens .bmp files also handles .dib without issue.
Most .dib files use uncompressed BI_RGB mode. Optional run-length encoding (BI_RLE8 for 8-bit, BI_RLE4 for 4-bit images) reduces file size modestly. Because the format is uncompressed by default, file sizes are large compared with PNG or JPEG equivalents.
Security & safety
RISK: LOWDIB/BMP is plain pixel data with no scripts or macros - low-risk format. Historical parser vulnerabilities (malformed header dimensions, bad RLE runs) could crash older image libraries, so keep your software updated. Avoid ad-laden "free DIB converter" sites; use IrfanView, GIMP, ImageMagick, or Squoosh instead.
Format details
in a nutshellPrograms that open DIB files
Technical details
deep spec| File signature | `BM` (hex `42 4D`) at byte offset 0 - BITMAPFILEHEADER magic bytes |
| Header variants | BITMAPCOREHEADER (12 bytes, OS/2), BITMAPINFOHEADER (40 bytes, Win3.0+), BITMAPV4HEADER (108 bytes), BITMAPV5HEADER (124 bytes, ICC profile support) |
| Supported color depths | 1, 4, 8, 16, 24, or 32 bits per pixel; 1/4/8-bit use an indexed palette; 16/24/32-bit are direct RGB |
| Alpha channel | Supported in 32-bit DIBs with BITMAPV4HEADER or BITMAPV5HEADER (Windows 98/2000+) |
| Pixel row order | Bottom-up by default (positive height value); negative height encodes a top-down image |
| Row padding | Each pixel row padded to a 4-byte (DWORD) boundary |
| Compression modes | `BI_RGB` (none, most common); `BI_RLE8` (8-bit RLE); `BI_RLE4` (4-bit RLE) |
| Color palette | Present for 1/4/8-bit images as an RGBQUAD array; absent for 16/24/32-bit direct-color |
| Byte order | Little-endian |
| In-memory vs on-disk | In-memory DIB omits the 14-byte BITMAPFILEHEADER; the `.dib` file on disk includes it, identical in layout to `.bmp` |
| Maximum dimensions | 32,767 × 32,767 px with BITMAPINFOHEADER (32-bit signed field); BITMAPCOREHEADER limited to 16-bit unsigned (65,535 px) |
| Resolution metadata | Horizontal and vertical resolution stored as pixels-per-meter in `biXPelsPerMeter` and `biYPelsPerMeter` fields |
| ICC color profile | Embeddable in BITMAPV5HEADER |
| Interoperability | `.dib` is fully interchangeable with `.bmp`; all BMP-capable applications open `.dib` files without modification |
| Released | 1985 (Windows 1.0/2.0); modern BITMAPINFOHEADER form with Windows 3.0, 1990 |
| Latest version | BITMAPV5HEADER (Windows 98/2000, 1998) |
| Open standard | Yes · royalty-free |
| Specification | learn.microsoft.com |
DIB conversions
Community Q&A
asked by usersNo questions yet - be the first to ask about DIB files.