piapia123
en

Decode Base64 into a File

Encoding

Everything runs locally in your browser — nothing is uploaded

BASE64 TEXT
RESULT
Detected type
–
Decoded size
–
data: prefix
–

Decoding happens entirely in your browser; nothing is uploaded. Line breaks, spaces, URL-safe - and _, and missing padding are all handled.

Turn a chunk of Base64 text back into a file — paste it, press download. It works with or without the `data:` prefix, and reads the type from that prefix (`data:image/png;base64,…` gives you `file.png` rather than `file.bin`). Pasting is messier than it looks, so everything tolerated here is something pasting causes, not a syntax error: line breaks and spaces are ignored entirely (PEM and MIME encoders wrap every 76 characters — that is the specification, not a mistake), the URL-safe `-` and `_` are understood (that is what JWTs use), and missing `=` padding is added. The three genuinely invalid cases are reported separately: characters outside the alphabet, a length of 4n+1 (no such encoding exists), and padding in the wrong place. ⚠️ One limitation: you have to supply the file name. Base64 carries no name, and the `data:` prefix only holds a type — the extension is all the tool can infer.

Features

  • Decodes both bare Base64 and data URLs, pulling the declared type out of the prefix
  • Infers the extension from the MIME type (png, pdf, woff2…), falling back to .bin rather than guessing
  • Ignores line breaks, spaces and tabs — PEM-wrapped text pastes straight in
  • Understands the URL-safe - and _ variants and missing = padding
  • Reports the three invalid cases with distinct reasons, not a single “bad format”
  • Shows the decoded size, the detected type and whether a data: prefix was present
  • Decoding happens entirely in your browser; nothing is uploaded

How to use

  1. Paste the Base64 text (or the whole data URL) into the box
  2. The type and size appear at once; the status turns ready when it can be downloaded
  3. Adjust the file name if you like (it is pre-filled with the inferred extension)
  4. Press Download

FAQ

Why is the decoded file called file.bin?
Because the Base64 you pasted had no `data:` prefix, and so carried no type information at all — Base64 encodes bytes, not what those bytes are. With the prefix (`data:image/png;base64,…`) the tool can infer `.png`. That is also the practical lesson: handing someone bare Base64 leaves them unable to know what to open it with, so say what it is when you send it.
Why is my pasted text reported as invalid?
Three possible reasons, and the message distinguishes them. Characters outside the alphabet: Base64 uses only `A–Z a–z 0–9 + / =`, and anything else usually means other text got mixed in — pasting a whole `<img src="data:…">` tag including its quotes brings those quotes along, and they are not valid. A length of 4n+1: after whitespace is removed the character count is always a multiple of four, and a remainder of one means a character is missing or extras were added. Padding in the wrong place: `=` may only appear at the end.
What is URL-safe Base64?
Standard Base64 uses `+` and `/`, both of which mean something in a URL (`+` is read as a space), so a variant swaps them for `-` and `_` and usually drops the `=` padding. JWTs use that variant, as does anything that stuffs binary into a URL. This tool reads both, so there is nothing to replace by hand.
Is pasting a very long Base64 slow?
Decoding itself is fast (milliseconds even for several megabytes) — what is slow is the input box rendering that much text, which is exactly why “File to Base64” caps at 4 MB. If you only need to decode a large file, `base64 -d input.txt > output` on the command line will be far more comfortable.

Related tools