Blog · How-To
How to Decode Base64: Step-by-Step Guide
Learn how to decode Base64 strings in JavaScript, Python, command line, and online. Covers UTF-8, binary data, and common mistakes.
You have a Base64 string. Maybe it came from an API response, a JWT token, or a data URI. You need to decode Base64 back into readable text. Here is how to do it, no matter what tools you have available.
Method 1: Online (No Code)
Go to base64go.com, switch to Decode mode, paste your Base64 string, and the decoded text appears instantly. The tool auto-detects standard Base64 and Base64URL. This is the fastest method for one-off decoding.
Method 2: JavaScript
// Simple ASCII-only decode (atob)
const decoded = atob("SGVsbG8gV29ybGQ=");
// "Hello World"
// UTF-8 safe decode (handles non-ASCII characters)
const binary = atob(base64String);
const bytes = Uint8Array.from(binary, c => c.charCodeAt(0));
const text = new TextDecoder().decode(bytes);
const decoded = atob("SGVsbG8gV29ybGQ=");
// "Hello World"
// UTF-8 safe decode (handles non-ASCII characters)
const binary = atob(base64String);
const bytes = Uint8Array.from(binary, c => c.charCodeAt(0));
const text = new TextDecoder().decode(bytes);
Method 3: Python
import base64
import json
# Decode text
decoded = base64.b64decode("SGVsbG8=").decode("utf-8")
# Decode JSON payload
payload = base64.b64decode(api_response["data"])
obj = json.loads(payload)
import json
# Decode text
decoded = base64.b64decode("SGVsbG8=").decode("utf-8")
# Decode JSON payload
payload = base64.b64decode(api_response["data"])
obj = json.loads(payload)
Method 4: Command Line
# Linux / Mac
echo "SGVsbG8=" | base64 --decode
# Decode a file
base64 --decode encoded.txt > output.txt
echo "SGVsbG8=" | base64 --decode
# Decode a file
base64 --decode encoded.txt > output.txt
Common Mistakes
- Using atob() on UTF-8. atob() only handles ASCII. For UTF-8 text, use TextDecoder as shown above.
- Forgetting padding. Some tools strip trailing =. Restore it before decoding.
- Mixing Base64 and Base64URL. Base64URL uses - and _ instead of + and /. Our tool auto-detects both.
- Decoding the wrong charset. Know whether the original data was UTF-8, UTF-16, or binary before decoding.
Ready to decode?
Paste your Base64 string and get instant results. No installs, no code.
Open Base64 Tool