Back to blog

October 6, 2026

Converting Hexadecimal to Image: A Complete Guide

Turn hex dumps, color lists, and Base64 image payloads into viewable images—and know which format you actually have.

Developers often meet images as hexadecimal text: debugger dumps, email attachments, SQL blobs, or copy-pasted byte strings. Converting that hex back into a viewable image is mostly about recognizing the format and decoding the bytes correctly.

What “hex to image” can mean

Not all hex represents the same thing:

  1. Encoded file bytes — hex of a PNG/JPEG/WebP/GIF file (starts with a known signature)
  2. Raw pixel buffers — RGB/RGBA samples without a container (needs width/height)
  3. Color lists — comma-separated hex colors forming a palette or simple graphic
  4. Base64 that was hex-escaped — sometimes people hex-encode a Base64 string by mistake

Knowing which case you have saves time.

File signatures to look for

When hex is a whole file, the header usually reveals the type:

Format Hex prefix (ASCII)
PNG 89 50 4E 47 (PNG)
JPEG FF D8 FF
GIF 47 49 46 38 (GIF8)
WebP 52 49 46 46 … 57 45 42 50 (RIFF … WEBP)

If you see one of these, decode hex → bytes → open as that file type. No custom width is required.

Step-by-step: hex file dump → image

  1. Copy the hex string (spaces and 0x prefixes are usually fine to strip).
  2. Confirm length is even (two hex digits per byte).
  3. Decode to binary.
  4. Check the signature bytes.
  5. Preview and download as PNG/JPEG/WebP.

The Convert Hex to Image tool accepts hex or Base64, shows a preview, and can download the result—useful for recovery and quick inspection.

Raw pixels and palettes

If there is no file header, you likely have raw samples:

  • Provide a width so bytes can be wrapped into rows
  • Confirm channel order (RGB vs RGBA)
  • Expect incomplete trailing bytes if length ≠ width × height × channels

Color-list input (e.g. #FF0000, #00FF00, #0000FF) is another path: the tool can render a simple palette-style image for visualization.

Hex vs Base64

Base64 is more common in JSON and data URIs (data:image/png;base64,...). If your payload is Base64, use Base64 mode (or Convert Base64 to Image) instead of hex. To go the other way for embedding, use Image to Base64.

Troubleshooting

  • Blank or broken preview — wrong format assumption; check the signature
  • Odd-length hex — truncated copy/paste
  • Garbled colors — raw buffer with wrong width or channel count
  • Huge hex — prefer uploading/decoding offline for multi‑MB dumps

Summary

Hex-to-image conversion is format detection plus byte decoding. Prefer container-aware dumps (PNG/JPEG/WebP) when you can; supply dimensions for raw buffers. Try a sample in Convert Hex to Image, and use the Base64 tools when your payload is already Base64 rather than hex.

Try these browser tools connected to this article.