Base64 is a binary-to-text encoding that represents binary data as ASCII strings. Decoding converts Base64 text back to the original data. Here are the fastest methods:
Method | Best For | Skill Level |
|---|---|---|
Quick, one-off decoding | No coding required | |
JavaScript (atob / Buffer) | Browser and Node.js apps | Basic JavaScript |
Python (base64 module) | Scripts and automation | Basic Python |
Command line (base64) | Shell scripting | CLI familiarity |
Base64 is an encoding scheme that converts binary data into a text format using 64 printable ASCII characters (A-Z, a-z, 0-9, +, /). It's not encryption — Base64 provides no security. It's used when binary data needs to be transmitted through text-only channels.
How it works:
Original: "Hello" Binary: 01001000 01100101 01101100 01101100 01101111 Base64: SGVsbG8=
Encoding: 3 bytes of input → 4 characters of Base64 Padding: = signs fill out the last group if needed
Common uses of Base64:
Email attachments — MIME encoding sends binary files through text-based email protocols
Data URIs — embedding images directly in HTML/CSS (data:image/png;base64,...)
API payloads — sending binary data (images, files) in JSON API requests
Authentication — HTTP Basic Auth encodes credentials in Base64 (username:password)
JWT tokens — JSON Web Tokens use Base64URL encoding for the header and payload
Use Qodex's free Base64 Encoder to encode data, or the Base64 Decoder to decode it.
The quickest way to decode Base64 is with Qodex's free Base64 Decoder:
Paste the Base64-encoded string
Click decode — the original text or binary data appears instantly
Copy the decoded output or download as a file
This works for text strings, encoded files, JWT payloads, and data URIs. No account required.
JavaScript provides built-in Base64 decoding in both browser and Node.js environments:
// Decode Base64 to string const decoded = atob("SGVsbG8gV29ybGQ="); console.log(decoded); // "Hello World"
// Decode Base64 to binary (for files/images) const base64 = "iVBORw0KGgo..."; // Base64 image const binary = atob(base64); const bytes = new Uint8Array(binary.length); for (let i = 0; i < binary.length; i++) { bytes[i] = binary.charCodeAt(i); } const blob = new Blob([bytes], { type: "image/png" });
// Decode Base64 to string const decoded = Buffer.from("SGVsbG8gV29ybGQ=", "base64").toString("utf-8"); console.log(decoded); // "Hello World"
// Decode Base64 to file const fs = require("fs"); const base64Data = "iVBORw0KGgo..."; fs.writeFileSync("image.png", Buffer.from(base64Data, "base64"));
Note: For URL-safe Base64 (used in JWTs), replace - with + and _ with / before decoding, or use Buffer.from(data, "base64url") in Node.js 16+.
Python's built-in base64 module handles all Base64 operations:
import base64Decode Base64 to string
encoded = "SGVsbG8gV29ybGQ=" decoded = base64.b64decode(encoded).decode("utf-8") print(decoded) # "Hello World"
Decode Base64 to file
with open("image.png", "wb") as f: f.write(base64.b64decode(base64_image_data))
URL-safe Base64 (for JWTs)
decoded = base64.urlsafe_b64decode(jwt_payload + "==") # Add padding if needed
Common gotcha: Base64 strings must have a length that's a multiple of 4. If padding (=) is stripped (common in JWTs and URLs), add it back: data += "=" * (4 - len(data) % 4).
Every Unix-like system includes a base64 command:
# Decode a string echo "SGVsbG8gV29ybGQ=" | base64 --decode # Output: Hello WorldDecode a file
base64 --decode encoded.txt > decoded.bin
macOS syntax (slightly different)
echo "SGVsbG8gV29ybGQ=" | base64 -D
Decode from clipboard (macOS)
pbpaste | base64 --decode
For Windows PowerShell:
[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String("SGVsbG8gV29ybGQ="))
JWT (JSON Web Token) payloads are Base64URL-encoded JSON objects. Decoding reveals the claims:
# JWT structure: header.payload.signature
# Decode the payload (middle part)
echo "eyJ1c2VyIjoiYWxpY2UiLCJyb2xlIjoiYWRtaW4ifQ" | base64 --decode
# {"user":"alice","role":"admin"}
Data URIs in HTML embed Base64-encoded images. Decode to extract the image file for editing or optimization.
HTTP Basic Authentication sends credentials as Base64: Authorization: Basic dXNlcjpwYXNz. Decoding reveals user:pass. This is why Basic Auth over HTTP (not HTTPS) is insecure — the credentials are only encoded, not encrypted. Always use HTTPS for API security.
Email attachments are MIME-encoded in Base64. If you need to extract an attachment from raw email source, decode the Base64 block to recover the original file.
No. Base64 is an encoding, not encryption. It provides zero security — anyone can decode a Base64 string instantly. Base64 simply converts binary data to text format for transmission through text-only channels (email, JSON, URLs). Never use Base64 to "protect" sensitive data like passwords or API keys. For actual security, use proper encryption (AES, RSA) or hashing (SHA-256).
Base64 converts every 3 bytes of binary data into 4 ASCII characters. This 3:4 ratio means Base64-encoded data is approximately 33% larger than the original. The trade-off is worthwhile when you need to transmit binary data through text-only channels. If size is a concern, consider compressing data before Base64-encoding, or using a more efficient binary transfer method.
Base64URL replaces two characters from standard Base64: + becomes - and / becomes _. This makes the encoded string safe for use in URLs and filenames, where + and / have special meanings. Base64URL also typically omits padding (=). JWTs and many web APIs use Base64URL instead of standard Base64.
Use JavaScript's built-in atob() function: atob("SGVsbG8=") returns "Hello". For decoding Base64URL (used in JWTs), first replace URL-safe characters: atob(str.replace(/-/g, '+').replace(/_/g, '/')). For a no-code approach, use Qodex's free Base64 Decoder directly in your browser.
Yes. Base64 can encode and decode any binary data — images, PDFs, executables, archives, or any other file type. The process is reversible: encoding converts bytes to text, and decoding converts the text back to the exact original bytes. In JavaScript, use Blob and Uint8Array for binary files. In Python, write decoded bytes with open('file', 'wb').
Common causes: missing padding characters (=) — add them to make the string length a multiple of 4; invalid characters — Base64 only allows A-Z, a-z, 0-9, +, /, and = (or -, _ for Base64URL); line breaks or whitespace — strip all whitespace before decoding; mixing Base64 and Base64URL — ensure you use the correct alphabet for your decoder.
Auto-discover every endpoint, generate functional & security tests (OWASP Top 10), auto-heal as code changes, and run in CI/CD - no code needed.


