SGVsbG8= = Hello

Base64 Encoder / Decoder

Encode plain text to Base64 or decode Base64 back to readable text. Supports standard and URL-safe RFC 4648 variants with full block-by-block breakdown.

Share this tool

Any Unicode text is supported. Input is encoded as UTF-8 bytes.

Whitespace is automatically removed before decoding.

Settings

Direction

Variant description placeholder.

Padding description placeholder.

Quick Load:

Converting...

Enter text or a Base64 string to encode or decode with full block breakdown.

What Is Base64 and How Does It Work?

Base64 is a binary-to-text encoding scheme that represents binary data as an ASCII string. It was designed to carry data across channels that only reliably support text content, such as email bodies, URLs, JSON payloads, and XML documents. Every 3 bytes of binary data are mapped to 4 ASCII characters from a 64-character alphabet.

The encoding process works by reading the input data in 24-bit groups (3 bytes). Each 24-bit group is then split into four 6-bit chunks, and each 6-bit value is mapped to one of the 64 printable ASCII characters. If the input length is not divisible by 3, one or two padding characters (=) are appended to the output so the total character count is always a multiple of 4.

Our converter automates the entire process and shows a per-block breakdown so you can verify that each 3-byte input group maps to the correct 4-character output. You can also switch between the standard and URL-safe variants, or control padding behavior when encoding.

Base64 Alphabet Table

The Base64 alphabet maps 6-bit values (0-63) to printable ASCII characters. The table below shows the complete alphabet with decimal and binary index values.

IndexCharIndexCharIndexCharIndexChar
0A16Q32g48w
1B17R33h49x
2C18S34i50y
3D19T35j51z
4E20U36k520
5F21V37l531
6G22W38m542
7H23X39n553
8I24Y40o564
9J25Z41p575
10K26a42q586
11L27b43r597
12M28c44s608
13N29d45t619
14O30e46u62+
15P31f47v63/

Standard Base64 vs URL-Safe Base64

Standard Base64 uses the characters + and / at indices 62 and 63. While these are valid in many contexts, they have special meanings in URLs and filesystem paths. The plus sign is interpreted as a space in URL query parameters, and the slash is interpreted as a path delimiter.

URL-safe Base64 solves this by replacing + with - (hyphen) and / with _ (underscore). This variant is defined in RFC 4648 section 5 and is commonly used in JWT tokens, URL parameters, and filenames.

When decoding, it is important to select the same variant that was used for encoding. Decoding a URL-safe string with the standard decoder will produce an error because - and _ are not valid characters in the standard alphabet.

Base64 Padding Explained

Padding ensures that the Base64 output always consists of complete 4-character blocks. Because Base64 converts 3 bytes into 4 characters, the input byte count must be divisible by 3 for the output to need no padding. If the input has 1 remaining byte, two = padding characters are added. If the input has 2 remaining bytes, one = padding character is added.

Input bytesOutput charsPaddingExample
340Man → TWFu
241Ma → TWE=
142M → TQ==

Common Base64 Use Cases

Use caseWhy Base64?
JWT tokensHeader and payload segments are Base64-encoded JSON.
Data URIsEmbeds images and fonts directly in CSS or HTML as text.
HTTP Basic AuthUsername:password is Base64-encoded in the Authorization header.
Email MIMEBinary attachments are encoded as Base64 text in email bodies.
URL parametersURL-safe Base64 encodes binary data in query strings without corruption.

Frequently Asked Questions

How do you encode text to Base64?

Select the Encode direction, type or paste your text, choose the variant (standard or URL-safe) and padding mode, then click Convert. The tool converts your text to UTF-8 bytes first, then applies Base64 encoding. The result includes a block-by-block breakdown showing exactly how each byte group was converted.

How do you decode a Base64 string?

Select the Decode direction, paste the Base64 string, choose the correct variant, and click Convert. The tool strips any whitespace automatically, validates the characters against the selected alphabet, decodes the bytes, and verifies that the result is valid UTF-8 text.

What is the difference between standard and URL-safe Base64?

Standard Base64 uses + and / as its last two alphabet characters. URL-safe Base64 replaces them with - and _ to avoid conflicts with URL encoding and filesystem paths. Always decode with the same variant used for encoding.

Why does Base64 output end with =?

The = padding characters ensure the output length is always a multiple of 4 characters. They indicate how many bytes were in the final incomplete group: two equals signs mean 1 byte, one equals sign means 2 bytes, and no padding means a complete 3-byte group. Some modern protocols omit padding, which is why our tool supports both modes.

Is Base64 encryption?

No. Base64 is an encoding scheme, not an encryption algorithm. It does not use a key and provides no security. Anyone can decode a Base64 string instantly. Base64 is used for data transport and storage compatibility, not for confidentiality. If you need to protect data, use a proper encryption tool.

Can Base64 contain spaces or newlines?

The Base64 alphabet itself does not include whitespace. However, it is common practice to insert line breaks every 76 characters when embedding Base64 in email or text files (PEM format). Our decoder automatically strips all whitespace before processing, so you can paste Base64 with line breaks without issue.