Skip to content

Base64 Decoder and Encoder

Paste a Base64 string to decode it back to text or to the file it came from, or encode text and files to Base64 and data URLs. Everything happens in your browser.

Drop a file or Base64 text here

Paste text, Base64, or upload any file to encode it instantly.

Text or any file, read in your browser

Base64 Controls

Waiting for input
Ready. Paste text, Base64, or choose a file to begin.

Input & Converted Output

No action yet Line 1, Col 1

Input

Editable 0 chars
1
Ready for input No file loaded
Detection idle

Output

Result preview 0 chars
1
No output yet Ready to download
Type idle

Base64 Analysis

Run the tool or click Analyze Input to inspect the current content here.

Result Snapshot

Snapshot idle
Detected Type—
Has Data URLNo
Base64 Chars0
Padding0
Estimated Bytes0 B
Output Size0 B

Runs in your browser. Nothing you type, paste or open here is uploaded.

To decode Base64, paste the string (or a full data:...;base64, URL) into the Input box and select Process Base64. If the decoded bytes are readable UTF-8 text, the text appears in Output. If they're a binary file such as a PDF or image, the tool shows its size and type and Download saves the restored file.

How to decode Base64 online

  1. Paste the Base64. Put the string in the Input box. Spaces and line breaks inside it are ignored, and a data:image/png;base64, prefix is read for its file type.
  2. Set the action. Action is on Auto detect, which decodes anything that looks like valid Base64. Set it to Decode or Encode to be explicit.
  3. Name binary files. For a file without a data URL prefix, type a MIME type such as application/pdf in Decoded MIME Type, or a name like invoice.pdf in Decoded File Name.
  4. Process and save. Select Process Base64 (Ctrl+Enter), then Copy Output for text or Download for the restored file.

How Base64 encoding works

Base64, defined in RFC 4648, turns any bytes into plain text that survives email, JSON and URLs. It takes 3 bytes (24 bits) at a time, splits them into four 6-bit groups, and maps each group to one of 64 characters: A-Z, a-z, 0-9, + and /. When the input isn't a multiple of 3 bytes, = pads the end.

InputBytesBase64
Man3TWFu
Ma2TWE=
M1TQ==
café5 (UTF-8)Y2Fmw6k=

Every 3 bytes become 4 characters, so Base64 is about 33% larger than the original. A 300 KB PDF becomes roughly 400 KB of text. Base64 is an encoding, not encryption: anyone can decode it, so don't use it to hide passwords. For that, see the text encryption tool.

Base64 encode text or files

Type or paste text and select Process Base64. The Base64 encoder reads text as UTF-8, so accented letters and emoji round-trip correctly. To encode a file, drop it on the upload box or choose Select File; any file type works. Set Encode Output to Data URL to get a ready-to-use string such as data:image/png;base64,iVBORw0KGgo..., which the tool builds from the file's own MIME type.

In code, the browser has btoa() and atob(), but they only handle Latin-1 characters, so btoa("café") works while btoa("€") throws an error. Encode text to UTF-8 bytes first with TextEncoder. In Python it's base64.b64encode(data) and base64.b64decode(text). For images you want to embed in HTML or CSS, the image to Base64 converter also writes the <img> and CSS snippets.

Base64 to PDF, PNG and other files

APIs often return documents as Base64 inside JSON. To get the file back, paste only the string value (without the surrounding quotes) and process it. If the data doesn't decode to readable text, Output shows "Binary file decoded successfully" with the name, MIME type and size, and Download saves it. The first few characters usually tell you the file type:

Starts withFile typeMIME type to enter
JVBERi0PDFapplication/pdf
iVBORw0KGgoPNG imageimage/png
/9j/JPEG imageimage/jpeg
UEsDBZIP (also DOCX, XLSX)application/zip

With a data URL prefix, the tool reads the type and names the file for you, for example decoded-document.pdf. Without one, the download is called decoded-file.bin unless you fill in Decoded MIME Type or Decoded File Name.

Why a Base64 decoder rejects a string

Standard Base64 uses the 64 characters above, a length that's a multiple of 4, and at most two = at the end. The decoder also accepts two common variants and converts them before decoding:

  • Base64url replaces + and / with - and _ so the text is safe in URLs. JSON Web Tokens use it. To read a whole token, header and claims included, use the JWT decoder.
  • Missing padding. Some systems drop the trailing =; the decoder adds it back.

Data URLs work with any parameters, such as data:text/plain;charset=utf-8;base64,..., and the non-Base64 form data:text/plain,Hello%20there is decoded too. A string is still rejected when it contains characters outside both alphabets, mixes + or / with - or _, or has one character too many to be Base64.

The reverse problem also happens: short words like Test or abcd1234 are valid Base64, so Auto detect decodes them. Set Action to Encode when you mean to encode plain words.

Frequently asked questions

How do I decode Base64 online?

Paste the Base64 string into the input box on this page and select Process Base64. Text appears in the output; binary data can be saved with Download.

How do I convert Base64 to a PDF?

Paste the Base64 string, type application/pdf in Decoded MIME Type (or a file name ending in .pdf), select Process Base64, then Download. A PDF's Base64 usually starts with JVBERi0.

Can I Base64 encode a file?

Yes. Select or drop any file and select Process Base64. You get the raw Base64 string, or a data URL if you set Encode Output to Data URL.

Why do I get "This does not look like valid Base64"?

The string contains characters that aren't in standard Base64 or Base64url, mixes the two alphabets, or has one character too many (it was probably cut or copied with an extra character). Base64url and missing = padding are accepted, so check that you copied the whole string.

Is Base64 a form of encryption?

No. Base64 is a reversible encoding with no key, so anyone can decode it. It's meant for carrying binary data through text-only channels.

Is my data uploaded when I decode it?

No. Encoding and decoding run in your browser with JavaScript, so files and text never leave your device.

Updated 11 October 2026Reviewed by the ToolzyLab teamHow we test our tools