Khronos Texture 2.0
image/ktx2
Released 2021
· by Khronos Group
Khronos Texture 2.0 (KTX2) is a next-generation container format for GPU textures. It significantly improves upon the original KTX format by natively integrating Basis Universal compression (ETC1S and UASTC) and Zstandard (zstd) supercompression. This allows a single KTX2 file to be transcoded at runtime into the optimal compressed texture format for any target GPU (desktop or mobile), eliminating texture fragmentation.
Technical Specifications
.ktx2
ETC1SUASTCZstandard (zstd)Raw GPU Formats (ASTC, BCn)
Magic Bytes & HTTP Headers
«KTX 20»\r\n\x1A\n
Browser Support Matrix
| Browser | Status | Min Version |
|---|---|---|
|
|
Not Supported | — |
|
|
Not Supported | — |
|
|
Not Supported | — |
|
|
Not Supported | — |
|
|
Not Supported | Legacy |
Advantages & Limitations
- Universal hardware compatibility: write once, transcode anywhere to the target GPU's preferred format (ASTC, BC7, PVRTC, etc.)
- Drastically reduces transmission size over networks thanks to Basis Universal and Zstandard supercompression
- Seamless integration with the glTF ecosystem for optimized 3D asset delivery
- Requires WebAssembly (Wasm) decoders and JavaScript loaders for web viewing, increasing initial application payload slightly
- Encoding textures into high-quality Basis Universal UASTC can be computationally intensive and slow
- Zero support in traditional 2D image viewers or native OS previews
Developer Code Snippets
File Detection Steps
How to programmatically detect a image/ktx2
file by reading its raw bytes:
- 1 Check the first 12 bytes for the KTX 2.0 signature (AB 4B 54 58 20 32 30 BB 0D 0A 1A 0A)
- 2 Parse the Data Format Descriptor (DFD) block to determine the internal compression payload (e.g., ETC1S or UASTC)
Software Support
Conversion Tools
Share & Embed
[](https://freewebptojpg.com/mime/image/ktx2)
<iframe src="https://freewebptojpg.com/mime/image/ktx2/embed" width="100%" height="280" style="border:1px solid #cbd5e1;border-radius:8px;" title="KTX2 Specs"></iframe>
JSON API
All data on this page is available as a free, open JSON API. Use it in your project, documentation, or tooling.
GET https://freewebptojpg.com/mime/image/ktx2.json
Open JSON
Frequently Asked Questions
What is the difference between KTX and KTX2?
KTX (v1.1) stored textures in a specific hardware format (like ASTC or BCn), meaning developers often had to ship multiple versions of the same texture for different devices. KTX2 integrates Basis Universal compression, allowing a single file to be dynamically transcoded at runtime into whatever native format the host GPU prefers, vastly reducing application bundle sizes.
What is the magic byte for a KTX2 file?
KTX2 files begin with a 12-byte identifier: AB 4B 54 58 20 32 30 BB 0D 0A 1A 0A. This translates to '«KTX 20»' followed by carriage return, line feed, substitute, and line feed characters.
How is KTX2 used on the web?
While not supported natively by HTML <img> tags, KTX2 is widely used in WebGL and WebGPU applications (via engines like Three.js and Babylon.js) and is the standard highly-compressed texture format for glTF 3D models (via the KHR_texture_basisu extension).