KTX2 Textures Explained: Mipmaps, Block Compression and Supercompression
What is inside a KTX2 file, how BC1 and BC3 compression and mip chains work, real sizes from an 8 by 8 test texture, and why Basis needs a transcoder.

KTX2 Textures Explained: Mipmaps, Block Compression and Supercompression
GPU textures are not stored like photographs. A game or a 3D viewer wants the pixels in a format the graphics card can sample directly, often block-compressed, together with a chain of smaller copies called mipmaps. KTX 2.0 from Khronos is a container built for exactly that, and it is the texture format behind glTF's compressed texture extensions.
What is in a KTX2 file
A KTX2 file starts with a 12-byte identifier, then a header giving the Vulkan format number, the width, height, depth, number of array layers, faces and mip levels, and the supercompression scheme. A level index gives the byte offset and length of each mip level. A data format descriptor states the colour model and transfer function, which says whether the values are sRGB or linear. Key and value pairs carry metadata such as the program that wrote the file. The pixel data follows, smallest mip level first.
Block compression in brief
BC1, also known as DXT1, stores each 4 × 4 block of pixels in 8 bytes: two 16-bit end colours and a 2-bit index per pixel picking one of four colours along the line between them. That is 4 bits per pixel. BC3, or DXT5, adds an 8-byte alpha block in the same style, for 8 bits per pixel. BC4 is that alpha block on its own for one channel, and BC5 two of them, often for normal maps.
Mipmaps
Each mip level is half the width and height of the one above, down to 1 × 1. When a texture is far away the GPU samples a smaller level, which avoids shimmering and saves bandwidth. A full chain adds about a third to the size.
Worked example: an 8 × 8 test texture
The KTX2 Texture Viewer and Encoder was tested with an 8 × 8 image whose left half is opaque red and right half fully transparent blue. Here are the files it writes:
- RGBA8 with mipmaps: four levels, 8 × 8, 4 × 4, 2 × 2 and 1 × 1, holding 256, 64, 16 and 4 bytes. The whole file is 644 bytes.
- The same with zlib supercompression: 371 bytes. The top level shrinks from 256 to 19 bytes because it is made of two flat colours, while the 1 × 1 level grows from 4 to 12 bytes, since compression has overhead on tiny data.
- BC1 with mipmaps: 312 bytes, with levels of 32, 8, 8 and 8 bytes, because even a 2 × 2 or 1 × 1 level takes a whole 4 × 4 block. The blue half comes back opaque, because BC1 here stores no alpha.
- BC3 without mipmaps: 272 bytes, with a single 64-byte level, and the alpha of 255 and 0 survives.
A smaller check, a 4 × 4 RGBA8 sRGB image saved with zlib, makes a 307-byte file with Vulkan format 43 that decodes back to exactly the same bytes.
What the viewer can open
Uncompressed 8-bit formats (R8, RG8, RGB8, RGBA8 and BGRA8, linear or sRGB), half and float RGBA, and BC1, BC3, BC4 and BC5 are decoded and shown level by level, with zlib-compressed levels inflated first. The header card lists the format, levels, supercompression, colour model and metadata, which is often what you need when an engine refuses a file.
About Basis Universal
Many KTX2 files made for the web use Basis Universal, either ETC1S with BasisLZ supercompression or UASTC. Those store data in an intermediate form that a transcoder converts to whatever the GPU supports. The transcoder is not available in this browser tool, so such files, and .basis files, get a clear message instead of a picture. The same goes for BC7, ETC2, ASTC and Zstandard supercompression.
Common mistakes
- Choosing BC1 for a texture with transparency. Pick BC3 or RGBA8 when alpha matters.
- Marking a normal map or roughness map as sRGB. Data textures should be linear; only colour images are sRGB.
- Using a quick encoder for final assets. The BC1 and BC3 fit here is simple and fast; production textures deserve a quality encoder.
- Forgetting mipmaps on textures that are seen at a distance. Without them, fine patterns flicker.
- Expecting zlib to shrink block-compressed data much. It helps flat areas, but busy BC data is already dense.
For checking what an exporter wrote, or making a small test texture for a viewer, a browser tool is often quicker than a command-line build.



