Home/Tools/Base64 Encoder/Decoder

Base64 Encoder / Decoder

Encode text to Base64 or decode Base64 back to plain text. Supports standard and URL-safe Base64.

All processing happens in your browser. No data is sent to any server.

0 characters
0 characters
Base64 output will appear here...

Try an Example

What is Base64?

Base64 is a binary-to-text encoding scheme that represents binary data using a set of 64 printable ASCII characters. The standard Base64 alphabet consists of uppercase letters A-Z (values 0-25), lowercase letters a-z (values 26-51), digits 0-9 (values 52-61), and two special characters + (value 62) and / (value 63). When the input length is not a multiple of three bytes, the output is padded with one or two = characters to make the encoded output a multiple of four characters.

Base64 encoding works by taking groups of three bytes (24 bits) and splitting them into four 6-bit values, each of which maps to one character in the Base64 alphabet. Because three bytes of input become four characters of output, Base64-encoded data is approximately 33% larger than the original binary data. Despite this size increase, Base64 remains essential for safely transmitting binary data through text-only channels such as email, JSON, XML, and URLs.

Base64 Alphabet

The complete Base64 index table. Each 6-bit value (0-63) maps to one character.

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

Padding character: = (used when input byte count is not a multiple of 3)

Common Uses for Base64

  • Email attachments (MIME) — Binary files are Base64-encoded so they can be transmitted as ASCII text in email protocols.
  • Data URIs in HTML/CSS — Small images and fonts can be embedded directly in markup using data:image/png;base64,... URIs.
  • JSON Web Tokens (JWT) — JWTs use URL-safe Base64 (base64url) to encode the header, payload, and signature sections.
  • HTTP Basic Authentication — Credentials are encoded as base64(username:password) in the Authorization header.
  • API keys and tokens — Many services issue API keys that are Base64-encoded binary values for safe transport in HTTP headers.
  • Storing binary data in JSON/XML — Since JSON and XML are text formats, binary blobs must be Base64-encoded before embedding.

Base64 vs URL-Safe Base64

Standard Base64 uses + and / as the 62nd and 63rd characters in its alphabet. However, both of these characters have special meaning in URLs: + is interpreted as a space, and / is a path separator. This makes standard Base64 unsafe for use directly in URLs and filenames.

URL-safe Base64 (also called base64url, defined in RFC 4648) solves this by replacing + with - (hyphen) and / with _ (underscore). Additionally, the = padding is often omitted since the original length can be inferred. URL-safe Base64 is used extensively in JWTs, OAuth tokens, and anywhere encoded data appears in URLs or filenames.

FeatureStandard Base64URL-Safe Base64
Character 62+- (hyphen)
Character 63/_ (underscore)
PaddingRequired (=)Optional
RFCRFC 4648 sec. 4RFC 4648 sec. 5