JSONToonPro
Encoding tool

Base64 Decode

Free online Base64 decoder. Convert Base64 encoded strings back to plain text instantly. Handles standard and URL-safe Base64. All processing in your browser.

100% client sideInstant resultNo data sent
Base64 Input
0 chars
Text Output
Result appears here...

How Base64 Decoding Works

Decoding runs the encoding pipeline backwards. Each Base64 character is looked up in the 64 character alphabet to recover the 6 bit value it represents. Four of those values are concatenated into a 24 bit block, and that block is sliced back into three 8 bit bytes. Padding at the end tells the decoder how many of those bytes are real.

  1. Strip any whitespace and line breaks, which carry no meaning.
  2. Convert each character to its index in the alphabet, 0 to 63.
  3. Join four indexes into a single 24 bit block.
  4. Split the block into three bytes, most significant bits first.
  5. Discard one byte for every trailing equals sign, then interpret the bytes.

Worked Example: Decoding "SGVsbG8="

This string has eight characters, one of which is padding, so it decodes to five bytes rather than six.

Input: S G V s b G 8 =
Indexes: 18 6 21 44 27 6 60 pad
Bits: 010010 000110 010101 101100 011011 000110 111100
 
Block 1: 010010000110010101101100
bytes: 01001000 01100101 01101100 = 72 101 108 = H e l
Block 2: 011011000110111100 + padding
bytes: 01101100 01101111 = 108 111 = l o
 
Output: Hello

Why Decoding Fails

Base64 is strict about shape, and most failures come from a handful of causes:

  • Invalid characters. Anything outside A-Z, a-z, 0-9, plus, slash, and equals is rejected. Copying from a chat client that inserts smart quotes or a zero width space is a frequent culprit.
  • Wrong length. Standard Base64 length must be a multiple of four once padding is included. A truncated copy and paste is the usual cause.
  • Missing padding. Many producers strip trailing equals signs. Add them back until the length divides by four.
  • URL-safe input in a standard decoder. Dashes and underscores are not in the standard alphabet and must be translated first.
  • Double encoding. If the decoded output is itself another valid looking Base64 string, the value was probably encoded twice.

Standard Base64 vs URL-Safe Base64

Standard Base64 uses plus and slash for indexes 62 and 63. Both are awkward in a URL: slash is a path separator and plus means a space in form encoded data. RFC 4648 section 5 therefore defines a URL and filename safe variant.

Standard index 62 = + index 63 = / padding kept
URL-safe index 62 = - index 63 = _ padding usually stripped
 
Standard: rqXRQrq/MQ==
URL-safe: rqXRQrq_MQ

JSON Web Tokens always use the URL-safe form without padding, which is why a JWT segment pasted into a strict standard decoder often fails. Convert dash to plus, underscore to slash, and pad the length up to a multiple of four before decoding.

Is the Decoded Output Text or Binary?

Base64 carries no type information, so the decoder cannot tell you what the bytes mean. If the result renders as readable words or valid JSON, it was text, almost always UTF-8. If you see replacement characters, control codes, or unprintable symbols, the payload was binary. A short signature at the start is often enough to identify it: bytes 89 50 4E 47 mean PNG, FF D8 FF means JPEG, 25 50 44 46 means PDF, and 50 4B 03 04 means a ZIP archive (which includes .docx and .xlsx files).

Decoding is not authenticationBeing able to decode a value proves nothing about where it came from. Base64 has no signature and no integrity check, so never treat decoded content as trusted input. Validate it exactly as you would validate anything else sent by a client.

The Base64 Alphabet

Every 6 bit group produces a value between 0 and 63, and that value is looked up in the table below. RFC 4648 fixes this ordering: uppercase letters first, then lowercase, then digits, then the plus and slash characters. The padding character (=) is not part of the alphabet, it only marks the end of an incomplete group.

IndexChar
0A
1B
2C
3D
4E
5F
6G
7H
8I
9J
10K
11L
12M
13N
14O
15P
IndexChar
16Q
17R
18S
19T
20U
21V
22W
23X
24Y
25Z
26a
27b
28c
29d
30e
31f
IndexChar
32g
33h
34i
35j
36k
37l
38m
39n
40o
41p
42q
43r
44s
45t
46u
47v
IndexChar
48w
49x
50y
51z
520
531
542
553
564
575
586
597
608
619
62+
63/

Working on something related? Browse every free developer tool on the site, including a Base64 encoder, JWT decoder, URL decoder, and JSON formatter. Everything runs entirely in your browser, so nothing you paste is ever uploaded.

Frequently asked questions

4 answers
Base64 decoding reverses the encoding process: it takes a string of Base64 characters (A-Z, a-z, 0-9, +, /) and converts them back to the original binary data or text. Every 4 Base64 characters map back to 3 bytes of original data. The decoder interprets those bytes as UTF-8 text to produce the human-readable output.

More JSON Tools

About Base64 Decoding

Base64 decoding is the inverse of encoding: it converts a Base64 string back into the original binary data or human-readable text. The process reads 4 Base64 characters at a time, extracts the 24 bits they represent, and writes 3 bytes of output. This decoder handles both standard Base64 (RFC 4648 Section 4) and URL-safe Base64 (RFC 4648 Section 5) automatically, accepting either + and / or - and _ as the special characters. It also handles inputs with missing padding, which is common in JWT tokens and certain API responses.