Free · No upload · No sign-up
Base64 decode, instantly.
Paste a Base64 string and get readable text, an image or a file back in the same keystroke. This Base64 decode online tool runs entirely in your browser — your data is never uploaded, never logged and never leaves your device.
Base64 decoder and encoder tool
Nothing you paste is uploaded. Decoding happens in JavaScript on this page — you can disconnect from the internet and it still works. Ctrl + Enter to run.
3 steps
How to decode Base64 online.
Paste your Base64
Drop the string into the input box on the left. A whole file, a data: URI, a JWT or a single line — all fine. Whitespace and line breaks are stripped for you.
Read the result instantly
Decoding starts as you type. There is no “submit” step and no waiting, because the work happens in your browser rather than on a server.
Copy, download or inspect
Copy the text, download binary output as a real file, flip to the hex view, or preview a decoded image right on the page.
What you get
A Base64 decoder that tells you what it found.
Most online decoders hand back a wall of characters and leave you to guess. This one identifies the payload, repairs the common encoding mistakes, and shows the result in whatever form actually helps.
Nothing leaves your device
Every byte is decoded by JavaScript on this page. No upload, no request, no logging — check your network tab.
Automatic format detection
PNG, JPEG, GIF, WebP, SVG, PDF, ZIP, MP4, JSON, XML and HTML are recognised from their signature bytes and labelled for you.
Base64 image preview
Decode an image and see it rendered immediately, with its real pixel dimensions and file size, then download it as a proper file.
20+ character sets
UTF-8, UTF-16, Latin-1, Windows-1250/1251/1252, Shift_JIS, GBK, Big5, KOI8-R and more — decoded locally, with auto-detection.
Hex dump view
Binary output gets a classic offset / hex / ASCII dump so you can inspect headers and magic bytes without leaving the page.
JWT aware
Paste a JSON Web Token and the header and payload are unpacked into a readable table, with timestamps converted to dates.
Forgiving input
Missing padding, URL-safe “-” and “_”, stray whitespace, MIME line wrapping and full data: URIs are all handled automatically.
Line-by-line mode
Decode a list of independent Base64 values in one pass, one result per line — handy for log files and exports.
Encoding too
Flip the switch to encode text or any file into Base64, with MIME line wrapping, the URL-safe alphabet, or a ready-made data: URI.
Comparison
How this compares to a typical online Base64 decoder.
| Feature | freebase64decode.com | Typical server-based tool |
|---|---|---|
| Decoding runs entirely in your browser | Always | Only in “live mode” |
| Character sets without a server round-trip | 20+ charsets, offline | Server-side only |
| File size limit | Your device’s memory | 100 MB, uploaded |
| Decoded image preview | Built in | Not available |
| Hex dump of binary output | Built in | Not available |
| JWT header and payload view | Automatic | Not available |
| URL-safe alphabet and padding repair | Automatic | Manual |
| data: URI detection | Automatic | Manual |
| Works with no internet connection | Yes, after first load | No |
| Accounts, ads or sign-up | None | Ads |
Guide
What is Base64?
Base64 is an encoding, not encryption. It rewrites arbitrary binary data using only 64 printable ASCII characters so that the data survives systems that were built for text. It provides no confidentiality whatsoever: anyone can decode it, which is exactly what this page does.
The scheme takes three bytes (24 bits) at a time and splits them into four 6-bit groups. Each group
indexes into the alphabet A–Z, a–z, 0–9, + and
/. Because 3 bytes become 4 characters, Base64 output is always about
33% larger than the input. When the input length is not a multiple of three, the
result is padded with one or two = characters.
A worked example
Take the word Man. In ASCII those three characters are the bytes 77, 97 and 110, which
in binary form the 24-bit sequence 010011010110000101101110. Split into four 6-bit
groups you get 19, 22, 5 and 46 — and looking those indexes up in the Base64 alphabet gives
TWFu.
| Text | M | a | n | |||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ASCII | 77 | 97 | 110 | |||||||||||||||||||||
| Bits | 0 | 1 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 0 | 1 | 1 | 1 | 0 |
| Index | 19 | 22 | 5 | 46 | ||||||||||||||||||||
| Base64 | T | W | F | u | ||||||||||||||||||||
Where you actually meet it
- Email. MIME encodes attachments in Base64, wrapped at 76 columns.
- Data URIs.
data:image/png;base64,…inlines an image into CSS or HTML. - JSON Web Tokens. Each of the three JWT segments is Base64url with the padding removed.
- HTTP Basic auth.
Authorization: Basiccarriesuser:passwordin Base64 — decodable by anyone, which is why it needs HTTPS. - Config and secrets files. Kubernetes secrets, certificates and private keys are routinely stored Base64-encoded.
- APIs and databases. Binary blobs travelling through JSON, XML or a text column.
Standard vs. URL-safe Base64
RFC 4648 defines two alphabets. The standard one uses + and /, which both
have special meaning inside a URL. The URL-safe variant (section 5, sometimes called Base64url)
swaps them for - and _, and usually drops the = padding
entirely. This decoder detects which one you pasted and converts automatically — a string containing
- or _ is treated as URL-safe unless you force the setting yourself.
How to decode a Base64 image
A Base64 image is usually stored as a data URI: a data:image/png;base64, prefix followed
by the encoded bytes. Paste the whole thing — prefix included — into the decoder above. The prefix is
recognised and stripped, the signature bytes are checked, and the picture is rendered in the
Preview tab with its real dimensions. Use Download to save it as a
genuine .png, .jpg, .gif, .webp or
.svg file.
If the preview stays blank, the bytes are not a valid image. The usual causes are a truncated string,
a copy that lost its last characters, or double encoding — check the Hex tab and look for a known
signature such as 89 50 4e 47 for PNG or ff d8 ff for JPEG.
Common decoding errors, and what they mean
- “Invalid character at position N.” Something in the string is outside the Base64 alphabet — most often a stray quote, an ellipsis from a truncated copy, or a URL-safe character while strict decoding is forced.
- Length is not a multiple of 4. The padding was removed. Turn Repair padding on; if the remainder is exactly one character, the string is genuinely truncated and cannot be recovered.
- Mojibake —
éinstead ofé. The bytes were decoded with the wrong character set. Try UTF-8 first, then Windows-1252. - Unreadable symbols everywhere. The payload is binary, not text. Switch to the Hex or Preview tab and download it instead.
Reference
Base64 decode in Python, JavaScript, Linux and more.
Once you have checked a value in the decoder above, you usually need the same thing in code. Every snippet below is copy-paste ready and covers the parts that normally bite: character sets, the URL-safe alphabet, and missing padding.
Python Base64 decode
Python's base64 module is in the standard library — no install needed. b64decode always returns bytes, so call .decode() when you want a str.
import base64
# Base64 string -> text
encoded = "SGVsbG8sIHdvcmxkIQ=="
text = base64.b64decode(encoded).decode("utf-8")
print(text) # Hello, world!
# Reject anything that is not valid Base64 instead of silently skipping it
base64.b64decode(encoded, validate=True)
# URL-safe alphabet (RFC 4648 section 5): "-" and "_" instead of "+" and "/"
base64.urlsafe_b64decode("SGVsbG8_d29ybGQtMQ==")
# Unpadded input (JWTs, URL parameters) raises binascii.Error -- pad it first
def b64decode_any(s: str) -> bytes:
s = s.replace("-", "+").replace("_", "/")
return base64.b64decode(s + "=" * (-len(s) % 4))
# Base64 -> image file on disk
with open("logo.png", "wb") as f:
f.write(base64.b64decode(image_b64))
# Decode every line of a file separately
with open("encoded.txt") as f:
for line in f:
print(base64.b64decode(line.strip()).decode("utf-8")) JavaScript Base64 decode
atob() returns a binary string, not text. On its own it mangles every non-ASCII character, so route the bytes through TextDecoder — that is exactly what this page does.
// ── Browser ──────────────────────────────────────────────
// Quick and dirty: correct only for pure ASCII
atob("SGVsbG8sIHdvcmxkIQ=="); // "Hello, world!"
// Correct for any UTF-8 payload
function base64Decode(b64) {
const bin = atob(b64);
const bytes = Uint8Array.from(bin, (ch) => ch.charCodeAt(0));
return new TextDecoder().decode(bytes);
}
base64Decode("SGVsbMO2LCB3w7ZybGQh"); // "Hellö, wörld!"
// Encoding back again
function base64Encode(str) {
const bytes = new TextEncoder().encode(str);
return btoa(String.fromCharCode(...bytes));
}
// URL-safe -> standard before decoding
const std = urlSafe.replace(/-/g, "+").replace(/_/g, "/");
// ── Node.js ──────────────────────────────────────────────
Buffer.from("SGVsbG8sIHdvcmxkIQ==", "base64").toString("utf8");
Buffer.from(token, "base64url").toString("utf8"); // Node 16+
Buffer.from("Hello, world!").toString("base64"); Linux Base64 decode from the command line
GNU coreutils ships base64 on every Linux distribution. Watch the two classic traps: echo appends a newline, and macOS/BSD spells the decode flag -D, not -d.
# Decode a string
echo "SGVsbG8sIHdvcmxkIQ==" | base64 --decode
# printf avoids the trailing newline echo adds
printf '%s' "SGVsbG8sIHdvcmxkIQ==" | base64 -d
# Decode a file into a binary file
base64 -d encoded.txt > decoded.png
# -i ignores line wrapping and other non-alphabet characters
base64 -di encoded.txt > decoded.bin
# macOS / BSD uses a capital D
base64 -D <<< "SGVsbG8sIHdvcmxkIQ=="
# Portable everywhere OpenSSL exists
echo "SGVsbG8sIHdvcmxkIQ==" | openssl base64 -d
# Encode, wrapping at 76 columns like MIME (-w 0 disables wrapping)
base64 -w 0 photo.jpg > photo.b64
# Decode a JWT payload (URL-safe, unpadded) with jq
cut -d. -f2 <<< "$JWT" | tr '_-' '/+' | base64 -d 2>/dev/null | jq . PHP Base64 decode
Pass true as the second argument so base64_decode() returns false on malformed input instead of quietly discarding bad characters.
<?php
$text = base64_decode('SGVsbG8sIHdvcmxkIQ==');
// Strict mode: false on invalid input
$text = base64_decode($encoded, true);
if ($text === false) {
throw new InvalidArgumentException('Not valid Base64');
}
// URL-safe decode with padding repaired
function base64UrlDecode(string $s): string {
$s = strtr($s, '-_', '+/');
return base64_decode($s . str_repeat('=', (4 - strlen($s) % 4) % 4));
}
// Base64 -> image file
file_put_contents('logo.png', base64_decode($imageB64));
// Encode a file as a data: URI for inline CSS or HTML
$uri = 'data:image/png;base64,' . base64_encode(file_get_contents('logo.png')); Java Base64 decode
java.util.Base64 has been built in since Java 8 and offers three decoders: basic, URL-safe, and MIME (which tolerates line breaks).
import java.nio.charset.StandardCharsets;
import java.util.Base64;
byte[] bytes = Base64.getDecoder().decode("SGVsbG8sIHdvcmxkIQ==");
String text = new String(bytes, StandardCharsets.UTF_8);
// URL-safe alphabet
Base64.getUrlDecoder().decode(token);
// MIME decoder: ignores line breaks and other stray characters
Base64.getMimeDecoder().decode(wrappedInput);
// Encode
String encoded = Base64.getEncoder()
.encodeToString("Hello, world!".getBytes(StandardCharsets.UTF_8));
// Base64 -> file
java.nio.file.Files.write(java.nio.file.Path.of("logo.png"),
Base64.getDecoder().decode(imageB64)); Go Base64 decode
Go's encoding/base64 makes the padding choice explicit: StdEncoding and URLEncoding expect padding, the Raw variants do not.
package main
import (
"encoding/base64"
"fmt"
)
func main() {
data, err := base64.StdEncoding.DecodeString("SGVsbG8sIHdvcmxkIQ==")
if err != nil {
panic(err)
}
fmt.Println(string(data)) // Hello, world!
// URL-safe, no padding -- the JWT flavour
base64.RawURLEncoding.DecodeString("SGVsbG8sIHdvcmxkIQ")
// Encode
fmt.Println(base64.StdEncoding.EncodeToString([]byte("Hello, world!")))
} C# Base64 decode
Use TryFromBase64String when the input comes from a user — it avoids the exception that Convert.FromBase64String throws on bad input.
using System;
using System.Text;
byte[] bytes = Convert.FromBase64String("SGVsbG8sIHdvcmxkIQ==");
string text = Encoding.UTF8.GetString(bytes);
// Non-throwing variant
Span<byte> buffer = new byte[input.Length];
if (Convert.TryFromBase64String(input, buffer, out int written))
{
text = Encoding.UTF8.GetString(buffer[..written]);
}
// URL-safe input
string std = input.Replace('-', '+').Replace('_', '/')
.PadRight(input.Length + (4 - input.Length % 4) % 4, '=');
// Encode
Convert.ToBase64String(Encoding.UTF8.GetBytes("Hello, world!")); Ruby, PowerShell and SQL Base64 decode
The same job in three more places you are likely to need it. strict_decode64 rejects whitespace; decode64 forgives it.
# ── Ruby ─────────────────────────────────────────────────
require "base64"
Base64.decode64("SGVsbG8sIHdvcmxkIQ==") # forgiving
Base64.strict_decode64("SGVsbG8sIHdvcmxkIQ==") # raises on stray characters
Base64.urlsafe_decode64(token)
# ── PowerShell ───────────────────────────────────────────
# [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($b64))
# [Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes("Hello, world!"))
# ── SQL ──────────────────────────────────────────────────
# MySQL 5.6+ SELECT FROM_BASE64('SGVsbG8sIHdvcmxkIQ==');
# PostgreSQL SELECT convert_from(decode('SGVsbG8=', 'base64'), 'UTF8');
# SQL Server SELECT CAST('' AS xml).value('xs:base64Binary("SGVsbG8=")', 'varbinary(max)');
# BigQuery SELECT SAFE_CONVERT_BYTES_TO_STRING(FROM_BASE64('SGVsbG8=')); FAQ
Base64 decoding, answered.
What is Base64 decode?
Base64 decode is the process of turning a Base64-encoded string back into the original bytes it represents. Base64 encoding takes binary data and rewrites it using 64 printable ASCII characters so it can travel safely through systems that only handle text, such as email or JSON. Decoding reverses that mapping: every four Base64 characters become three original bytes.
How do I decode a Base64 string online?
Paste the Base64 string into the input box at the top of this page. The decoded result appears immediately in the output box beside it — there is no button to press and no waiting. You can then copy the text, download it as a file, view it as a hex dump, or preview it if the result is an image.
Is this Base64 decoder safe to use with sensitive data?
Yes. All decoding happens in JavaScript inside your own browser, so your input is never uploaded, transmitted, logged or stored anywhere. You can verify this by opening your browser developer tools and watching the network tab while you decode, or by disconnecting from the internet — the tool keeps working after the page has loaded.
Is Base64 encryption? Is it secure?
No. Base64 is an encoding, not encryption. It offers no security at all because anyone can reverse it without a key or password, which is exactly what this page does. Never use Base64 to protect passwords, tokens or personal data. Use real encryption such as AES, and TLS for data in transit.
How do I decode a Base64 image?
Paste the full data URI, including the data:image/png;base64, prefix, or just the encoded part on its own. The prefix is stripped automatically and the image signature is checked, so the picture appears in the Preview tab together with its pixel dimensions and file size. Use the Download button to save it as a real PNG, JPEG, GIF, WebP or SVG file.
Why does my decoded text show strange characters like é or �?
That is a character set mismatch: the bytes are correct but they are being interpreted with the wrong encoding. Set the character set option to UTF-8 first. If the data came from an older Windows application, try Windows-1252 or ISO-8859-1. Leaving the setting on Auto-detect tries strict UTF-8 first and falls back to Windows-1252.
What does “invalid Base64” mean and how do I fix it?
It means the input contains a character outside the Base64 alphabet, or its length is not a multiple of four. The usual causes are a truncated copy, a quotation mark or ellipsis that came along with the text, or a URL-safe string using - and _ . Keep the Strip whitespace and Repair padding options on, and the decoder fixes most of these automatically.
What is the difference between standard and URL-safe Base64?
Standard Base64 (RFC 4648 section 4) uses + and / as its last two characters, both of which have special meaning inside a URL. URL-safe Base64, also called Base64url (RFC 4648 section 5), replaces them with - and _ and usually omits the = padding. This decoder detects which variant you pasted and converts it automatically.
Can I decode a Base64 file?
Yes. Click the File button or drag a file onto the input box. The file is read locally by your browser, decoded on your own device, and the result can be downloaded with the correct extension. Because nothing is uploaded there is no imposed size limit — the practical ceiling is your device memory rather than a server quota.
How do I decode Base64 in Python?
Use the standard library: import base64, then base64.b64decode("SGVsbG8=").decode("utf-8"). b64decode always returns bytes, so call .decode() to get a string. Use base64.urlsafe_b64decode for the URL-safe alphabet, and pass validate=True if you want malformed input to raise an error instead of being silently ignored.
How do I decode Base64 in Linux or Bash?
Pipe the string into the base64 command: echo "SGVsbG8=" | base64 --decode. Use printf %s instead of echo if the trailing newline matters, base64 -d file > out.bin for files, and base64 -di to ignore line wrapping. On macOS and BSD the flag is a capital -D.
How do I decode Base64 in JavaScript?
In the browser, atob() decodes to a binary string, but it mangles non-ASCII text on its own. Convert the result to bytes and run it through TextDecoder: new TextDecoder().decode(Uint8Array.from(atob(b64), c => c.charCodeAt(0))). In Node.js use Buffer.from(b64, "base64").toString("utf8"), or the "base64url" encoding for URL-safe input.
Can I decode a JWT here?
Yes. Paste a JSON Web Token and the header and payload are unpacked into a readable table automatically, with issued-at and expiry timestamps converted into dates. The signature is shown but not verified, because verification requires the secret or public key — which this tool never asks for and could not use anyway, since nothing leaves your browser.
Does this tool cost anything or require an account?
No. It is completely free, has no sign-up, no account and no usage limits. It is a static page, so there is no server processing your data and nothing to bill you for.
Why is Base64 output larger than the original data?
Base64 represents every three bytes of input with four output characters, so the encoded form is roughly 33% larger, plus padding and any line breaks. That overhead is the price of being able to move binary data through text-only channels.
Decode Base64 without handing your data to anyone.
No account, no upload, no size limit, no ads in the way. Scroll back up and paste — the answer is already there.
Open the decoder