User Rating 0.0 โ˜…โ˜…โ˜…โ˜…โ˜…
Total Usage 0 times
0 characters ~0 B decoded
Quick presets:
Is this tool helpful?

Your feedback helps us improve.

โ˜… โ˜… โ˜… โ˜… โ˜…

About

Base64 encoding inflates data by approximately 33% because it maps every 3 input bytes to 4 ASCII characters drawn from a 64-character alphabet. Decoding reverses this: each group of 4 encoded characters reconstructs 3 original bytes. A single corrupted character or misplaced padding (=) produces a complete decode failure, not partial garbage. This tool validates the input character set before attempting the decode, reports the exact position of illegal characters, and handles both standard (RFC 4648 ยง4) and URL-safe (RFC 4648 ยง5) alphabets. Output modes include UTF-8 text, raw ASCII, hexadecimal byte dump, and binary representation.

Note: this decoder assumes the source data was encoded as a single contiguous Base64 string. MIME-style line breaks (every 76 characters) are stripped automatically. The tool approximates decoded size as 34 ร— n, where n is the encoded length excluding padding. Pro tip: if you receive a Base64 string starting with ey, it is almost certainly a JSON Web Token (JWT) payload encoded without encryption.

base64 decode string decoder base64 to text encoding developer tools

Formulas

The decoded byte length from a Base64 string is computed as:

Lbytes = 34 ร— n โˆ’ p

where n = total number of Base64 characters (excluding whitespace), and p = number of padding = characters (0, 1, or 2).

Each Base64 character encodes 6 bits. Four characters therefore encode 24 bits (3 bytes). The decode mapping for a single character c is:

index(c) =
{
c โˆ’ 65 if c โˆˆ [A - Z]c โˆ’ 71 if c โˆˆ [a - z]c + 4 if c โˆˆ [0-9]62 if c = + or -63 if c = / or _

The three output bytes from four indices (i0, i1, i2, i3) are reconstructed via bitwise operations:

byte0 = (i0 << 2) | (i1 >> 4)
byte1 = ((i1 & 0xF) << 4) | (i2 >> 2)
byte2 = ((i2 & 0x3) << 6) | i3

Reference Data

Character RangeIndex RangeCountDescription
A - Z0 - 2526Uppercase Latin letters
a - z26 - 5126Lowercase Latin letters
0-952 - 6110Decimal digits
+621Standard alphabet only
/631Standard alphabet only
-621URL-safe replacement for +
_631URL-safe replacement for /
=Padding0 - 2Pad to multiple of 4
Common Base64 Prefixes
ey... - - JSON object (JWT header/payload)
iVBOR... - - PNG image file
/9j/... - - JPEG image file
UEsDB... - - ZIP / DOCX / XLSX archive
JVBER... - - PDF document
R0lGO... - - GIF image file
AAAA... - - Binary data (null bytes)
PD94b... - - XML document
SFRU... - - HTTP response (starts with "HTT")
PHN2Z... - - SVG image file
Size Ratios
Encoding overhead33.33% size increase (3 bytes โ†’ 4 chars)
Decoding ratio75% of encoded size (4 chars โ†’ 3 bytes)
Bits per character6 bits (log264)
Max line length (MIME)76 characters (RFC 2045)
Max line length (PEM)64 characters (RFC 7468)

Frequently Asked Questions

RFC 4648 requires the encoded string length to be a multiple of 4, achieved by appending 1 or 2 padding characters (=). This tool auto-corrects missing padding before decoding. If n mod 4 equals 2, two = are appended; if 3, one is appended. A remainder of 1 indicates a fundamentally corrupted string and will produce an error.
URL-safe Base64 (RFC 4648 ยง5) replaces + with - and / with _. This tool detects the presence of - or _ characters and normalizes them to + and / before decoding. Both variants can coexist in the same string without issue.
The original data was likely not plain text. Base64 encodes arbitrary binary data. If the source is a PNG image, a ZIP archive, or an encrypted payload, decoding it as UTF-8 text will produce replacement characters (U+FFFD). Switch the output mode to Hex or Binary to inspect the raw bytes. Common binary prefixes: iVBOR for PNG, /9j/ for JPEG, UEsDB for ZIP.
No. Base32 uses a 32-character alphabet (A - Z, 2-7) and Base16 uses 16 characters (0-9, A - F). Their decoding algorithms differ in bits-per-character: 5 for Base32 and 4 for Base16, versus 6 for Base64. Feeding a Base32 string into this decoder will either fail validation or produce incorrect output.
Browser JavaScript strings are limited to approximately 512MB in modern engines (V8). However, the native atob function may throw on strings exceeding a few hundred megabytes depending on available memory. This tool warns at 5MB of input and processes up to approximately 50MB reliably. For larger payloads, chunk the input into segments aligned to 4-character boundaries.
No. This tool strips all whitespace characters (spaces, tabs, carriage returns, newlines) before decoding. MIME-encoded Base64 (RFC 2045) inserts line breaks every 76 characters, and PEM format uses 64-character lines. Both are handled transparently.