How to Decode Base64: Step-by-Step Guide

Everything you need to know about decoding Base64 - what it is, how it works, common errors, and a free tool to do it instantly.

Base64 Input
Decoded Text
🔒 100% client-side - your data never leaves your browser
Advertisement

What Is Base64?

Base64 is a binary-to-text encoding scheme that represents binary data - such as images, files, or raw bytes - using only 64 printable ASCII characters: A-Z, a-z, 0-9, +, and /, with = used for padding. It's widely used to safely embed binary data inside text-based formats like JSON, XML, HTML, email (MIME), and URLs.

"Decoding Base64" simply means reversing this process: taking a Base64 string and converting it back into the original data it represents - whether that's plain text, a JSON object, an image, or any other file.

How to Decode Base64: Step-by-Step

  1. Copy the Base64 string you want to decode, including any trailing = or == padding characters at the end.
  2. Paste it into the input box above. The decoder accepts strings of any length, including multi-line strings with line breaks.
  3. Check if it's Base64URL. If the string contains - or _ characters instead of + and /, tick the "URL-safe Base64" checkbox - this is common for JWTs, tokens, and URL parameters.
  4. Click "Decode from Base64". The tool reads each character, maps it back to its original 6-bit value, reassembles the bytes, and decodes the result as UTF-8 text.
  5. Copy or use the result. Click "Copy" to copy the decoded text to your clipboard, or "Swap" to decode the output again.

How Base64 Decoding Works Internally

Each Base64 character represents 6 bits of data (since 26 = 64). The decoder reads four Base64 characters at a time (4 × 6 = 24 bits) and regroups those 24 bits into three 8-bit bytes. If the original data wasn't a multiple of 3 bytes long, one or two = padding characters at the end tell the decoder how many of the final bytes to discard.

Once the raw bytes are reconstructed, they're interpreted according to the expected format - as UTF-8 text for plain strings, as JSON for structured data, or as a binary file signature (PNG, JPEG, PDF, etc.) for files and images.

Decoding Base64 Without an Online Tool

If you prefer the command line, here's how to decode Base64 on different systems:

EnvironmentCommand
macOS / Linux (terminal) echo "BASE64_STRING" | base64 --decode
Windows PowerShell [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String("BASE64_STRING"))
JavaScript atob("BASE64_STRING")
Python base64.b64decode("BASE64_STRING").decode("utf-8")

These methods work fine for quick checks, but a browser-based decoder like the one on this page is faster for everyday use - no terminal, no escaping issues with special characters, and built-in handling for Base64URL and UTF-8.

Common Base64 Decoding Errors and Fixes

"Invalid character" errors

The standard Base64 alphabet only contains A-Z, a-z, 0-9, +, /, and =. If your string contains - or _, it's Base64URL - enable the "URL-safe Base64" checkbox above, or use our dedicated Base64URL tool.

Missing padding

A valid Base64 string's length should be a multiple of 4. Systems like JWTs often strip the trailing = padding. This decoder automatically restores missing padding, so you generally don't need to add it back manually.

Garbled or unreadable output

If the decoded result looks like random symbols, the original data likely wasn't text - it could be an image, PDF, or another binary file. In that case, try Base64 to Image, Base64 to PDF, or Base64 to File instead of the plain-text decoder.

Why You Might Need to Decode Base64

Decoding Base64 is a common task for developers and curious users alike. Typical scenarios include reading the payload of a JWT (JSON Web Token), inspecting an API response that returns binary data as a Base64 string, viewing the contents of a data: URI, checking what an encoded environment variable or configuration value actually contains, or decoding an email attachment encoded with MIME Base64.

Frequently Asked Questions

None. You can decode Base64 directly in your browser using the free tool on this page - no installation, sign-up, or command-line knowledge required.

Once this page has loaded, decoding works entirely offline since all processing happens locally in your browser's JavaScript engine - nothing is sent to a server.

On macOS/Linux, run echo "STRING" | base64 --decode. On Windows PowerShell, use [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String("STRING")). For everyday use, the online decoder above is faster and avoids shell-escaping issues.

The original data probably wasn't plain text - it might be an image, PDF, or other binary file. Try our Base64 to Image, Base64 to PDF, or Base64 to File converters instead.

No. Base64 is an encoding, not encryption - it provides zero security. Decoding just reverses the encoding to reveal the original data, and anyone can do it without a password or key.

Related Tools