# Base64 Decoder

> Paste Base64 or a data URI to see the image, play the audio or read the text, download the file, or encode text to Base64.

- Page: https://codethatmoves.com/tools/images/base64-decoder/
- Site: Code That Moves
- Category: Images and files
- Free, runs in the browser, nothing is uploaded
- Last checked: 2026-11-03

## What it does

- Decodes Base64 and data URIs to an image preview, an audio player or text
- Detects PNG, JPEG, GIF, WebP, SVG, HEIC, AVIF, TIFF, PDF, ZIP, MP3, M4A, FLAC, WebM, fonts and more from the first bytes
- Finds the data URI inside pasted CSS url(...), JSON quotes or an HTML src attribute, accepts URL-safe Base64 and missing padding, and ignores spaces and line breaks
- Shows the image dimensions, and copies bare Base64 back as a full data URI
- Reads text as UTF-8, Latin-1 or UTF-16 LE
- Downloads the decoded file with the right extension
- Encodes text (as UTF-8) or any file to Base64, standard or URL-safe

## How to use it

1. Paste the Base64 text or the whole data URI.
2. Read what it is. An image shows as a preview, audio plays, text appears, anything else shows its first bytes.
3. Download the file, or switch to Encode text or a file to turn text or a file into Base64.

## What it checks and why

Base64 writes binary data using 64 printable characters, so a file can travel inside text such as JSON, an email or a web page. Decoding reverses that. A data URI adds a prefix that names the file type, like data:image/png;base64, and then the data.

The decoder cleans the input first: it drops the prefix, removes spaces and line breaks, turns the URL-safe characters - and _ back into + and /, and adds the missing = padding. Then it looks at the first bytes of the result. Every common format starts with a fixed signature, so the tool can tell a PNG from a JPEG or a PDF even when the prefix is missing or wrong.

Text is decoded as UTF-8 by default; switch to Latin-1 or UTF-16 LE for text saved by older Windows tools. If the bytes are not valid text, you see a hex dump of the first bytes instead, which is usually enough to recognise what the data is. The encoder works the other way and handles accents and emoji, because it converts text to UTF-8 bytes first.

## Reference data

| Detected from the first bytes | Type |
| --- | --- |
| 89 50 4E 47 | PNG image |
| FF D8 FF | JPEG image |
| GIF8 | GIF image |
| RIFF ... WEBP | WebP image |
| %PDF | PDF document |
| 50 4B 03 04 | ZIP archive |
| ID3 or FF FB | MP3 audio |
| OggS | Ogg audio |
| <svg | SVG image (text) |

## Specs and sources

- [RFC 4648: Base64 data encodings](https://datatracker.ietf.org/doc/html/rfc4648)
- [RFC 2397: The data URL scheme](https://datatracker.ietf.org/doc/html/rfc2397)
- [MDN: atob()](https://developer.mozilla.org/en-US/docs/Web/API/Window/atob)

## Limits

- The file type is read from the first bytes, so a rare format may show as plain binary.
- Very large inputs, many megabytes of text, are slow to paste and decode.
- Decoding is not decryption. Base64 hides nothing, and anyone can read what it holds.

## Questions

### How do I convert Base64 to an image?

Paste the Base64 text or the full data URI. If the data is an image, the tool shows a preview and a download button, and it picks the right extension from the file signature.

### Why does my Base64 string fail to decode?

The usual causes are a character that is not Base64, such as a stray symbol, a cut-off string, or text around the data. Quotes, CSS url(...) and src="..." around a data URI are removed for you. For anything else the tool names the first bad character and its position.

### What is URL-safe Base64?

A variant that uses - and _ in place of + and /, and often drops the = padding, so the text can sit in a URL or a JWT. The decoder accepts both forms, and the encoder can write either.

### Is Base64 a form of encryption?

No. It only changes how data is written. Anyone can decode it, so never use it to protect a secret.
