Free webp to jpg
KTX2

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.

3D & Textures Transparency ✦ HDR Production Ready

Technical Specifications

MIME Type
image/ktx2
Extensions
.ktx2
Container
KTX 2.0
Compression
Basis Universal (ETC1S / UASTC) & Zstandard (zstd) Supercompression & Uncompressed
Algorithms
ETC1SUASTCZstandard (zstd)Raw GPU Formats (ASTC, BCn)
Color Depth
8-bit, 16-bit, 32-bit (Float)
Metadata
None
Capabilities
Transparency
Animation
Progressive Loading
Alpha Channel
HDR Support

Magic Bytes & HTTP Headers

File Signature (Magic Bytes)
AB 4B 54 58 20 32 30 BB 0D 0A 1A 0A
ASCII: «KTX 20»\r\n\x1A\n
HTTP Headers
Content-Type: image/ktx2
HTML Accept Attribute
accept="image/ktx2, .ktx2"

Browser Support Matrix

Browser Status Min Version
Chrome Chrome
Not Supported
Firefox Firefox
Not Supported
Safari Safari
Not Supported
Edge Edge
Not Supported
Internet Explorer Internet Explorer
Not Supported Legacy

Advantages & Limitations

Advantages
  • 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
Limitations
  • 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

import magic
print(magic.from_file('model_texture.ktx2', mime=True)) # May output 'image/ktx2' if magic db is updated
const FileType = require('file-type');
const type = await FileType.fromFile('model_texture.ktx2');
console.log(type?.mime); // Outputs 'image/ktx2'
import "net/http"
// Requires custom byte checking for the KTX 2.0 header: bytes.HasPrefix(buf, []byte{0xAB, 0x4B, 0x54, 0x58, 0x20, 0x32, 0x30, 0xBB, 0x0D, 0x0A, 0x1A, 0x0A})
$mime = mime_content_type('model_texture.ktx2');
echo $mime; // Standard setups will often resolve to application/octet-stream without custom magic rules

File Detection Steps

How to programmatically detect a image/ktx2 file by reading its raw bytes:

  1. 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. 2 Parse the Data Format Descriptor (DFD) block to determine the internal compression payload (e.g., ETC1S or UASTC)

Software Support

T
Three.js (KTX2Loader)
B
Babylon.js
B
Blender
K
Khronos toktx CLI Tool
G
Godot Engine

Conversion Tools

Share & Embed

Markdown Badge
KTX2 Format Badge
[![KTX2 Format](https://freewebptojpg.com/mime/image/ktx2/badge.svg)](https://freewebptojpg.com/mime/image/ktx2)
Interactive iframe Widget
<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
Free to use
No auth required
CORS enabled
Use from any domain
Cached 24h
Cache-Control headers set

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).

Related Formats

Share this format