HomeFormattersDataBase64 Encoder / Decoder

Base64 Encoder / Decoder

Data

Encode any text or data to Base64, or decode Base64 strings back to plain text instantly. Free, client-side — nothing you paste is ever uploaded.

Reviewed by the thecalcu.com team · Last updated July 28, 2026

What is a Base64?

A Base64 Encoder / Decoder converts text to and from Base64 encoding, a scheme that represents binary or text data using only 64 safe ASCII characters (A–Z, a–z, 0–9, +, /) plus = for padding. Base64 was originally designed to allow binary file attachments to pass through email systems that only supported 7-bit ASCII text. Today it is ubiquitous in web development: HTTP Basic Auth headers, JWT tokens, data URIs for embedded images, and binary data in JSON APIs all rely on Base64.

This tool handles Unicode text correctly by encoding the input as UTF-8 bytes before applying Base64, ensuring that non-ASCII characters (accented letters, Indian scripts, emoji) are encoded faithfully and can be decoded back without loss. The encoder uses the standard Base64 alphabet; decoding accepts standard Base64 with or without padding.

Base64 is an encoding, not encryption, anyone who sees a Base64 string can decode it in seconds. If you need to protect data, use encryption separately from encoding.

For URL encoding needs, the URL Encoder / Decoder handles percent-encoding. For JSON formatting, see the JSON Formatter.


Why Use a Base64 Encoder / Decoder?

The most common use case is debugging. When an API returns a Base64-encoded response (a token, a certificate, a file attachment), you need to decode it to read the underlying content. Similarly, when building an integration that requires Base64-encoded parameters, you need to verify your encoding is correct before sending.

Other frequent uses: extracting the payload section of a JWT to inspect claims, encoding credentials for an HTTP Basic Auth header to test with curl or Postman, and generating data URI strings for small inline images in HTML.


Who Should Use This Tool?

Backend and API developers, decode Base64 responses from APIs, encode test payloads, and inspect JWT token payloads.

Front-end developers, generate data URIs for small assets, verify encoded values in localStorage or cookies, and debug authentication headers.

DevOps and platform engineers, decode Kubernetes secrets (which are Base64-encoded), inspect certificate data, and verify environment variable encoding.

Security engineers, inspect encoded payloads in HTTP traffic, decode obfuscated strings in scripts (noting that Base64 is not encryption), and verify token structures.


What Insights Does This Formatter Give You?

Encoding mode takes any Unicode text and returns the standard Base64 representation of its UTF-8 byte sequence. The output can be copied directly into any context that accepts Base64-encoded data.

Decoding mode takes a Base64 string and returns the original text. If the input is invalid Base64, a clear error message explains the problem.


How to use this Base64 calculator

  1. Paste your input text (or Base64 string) into the Input field.
  2. Select Encode → Base64 or Decode ← Base64 from the Mode selector.
  3. The output appears instantly in the Output field.
  4. Click the copy icon on the output field to copy the result.
  5. For decoding, ensure the input uses only valid Base64 characters (A–Z, a–z, 0–9, +, /, =).

Formula & Methodology

Encoding (text → Base64):
1. Convert the input string to UTF-8 bytes (handles Unicode correctly)
2. Group bytes into 3-byte chunks
3. Convert each 3-byte chunk (24 bits) into four 6-bit values
4. Map each 6-bit value to a character in the Base64 alphabet (A–Z = 0–25, a–z = 26–51, 0–9 = 52–61, + = 62, / = 63)
5. Append = padding if the input length is not a multiple of 3

Decoding (Base64 → text):
1. Strip whitespace
2. Map each Base64 character back to its 6-bit value
3. Reassemble 6-bit groups into 3-byte chunks
4. Decode the bytes as UTF-8 text
5. Return a clear error if any character is outside the Base64 alphabet

Valid example: Hello, World!SGVsbG8sIFdvcmxkIQ==

Invalid decode example: SGVsbG8!, ! is not a valid Base64 character

Frequently Asked Questions

Base64 is a binary-to-text encoding scheme that converts arbitrary data into a string of 64 ASCII characters (A–Z, a–z, 0–9, +, /). It is designed to safely transmit binary data over channels that only support text, such as email (MIME), HTTP headers, and JSON payloads. Base64 is an encoding, not encryption, it provides no security.
Use Base64 when you need to embed binary data in a text-based format. Common scenarios include: embedding images as data URIs in HTML/CSS, encoding authentication credentials in HTTP Basic Auth headers, encoding file attachments in email (MIME), and passing binary data through JSON APIs. Base64 is also used in JWT tokens to encode the header and payload sections.
No, Base64 increases the size of the original data by approximately 33%. Every 3 bytes of input become 4 Base64 characters. If you need to reduce data size, compress first (gzip, deflate) and then Base64-encode the compressed output if the transport channel requires text.
Base64 encodes 3 bytes at a time into 4 characters. When the input length is not a multiple of 3, one or two = characters are appended to pad the output to a multiple of 4 characters. One = means one padding byte was needed; == means two were needed. Padding is required by the standard but some implementations omit it, both forms are usually accepted by decoders.
Standard Base64 uses + and / characters, which have special meanings in URLs. URL-safe Base64 replaces + with - and / with _, making the encoded string safe to use in URL query parameters without additional percent-encoding. This tool uses standard Base64, if you need URL-safe output, replace + with - and / with _ after encoding.
This tool encodes text input, it accepts Unicode text and produces the Base64 representation of the UTF-8 bytes of that text. To encode binary files like images, use a dedicated file encoder. For embedding images in HTML, the data URI format is: data:image/png;base64,[encoded string].
No. Base64 is trivially reversible, anyone who sees a Base64 string can decode it in seconds. Never use Base64 to 'hide' passwords, API keys, or sensitive data. For secure storage use a strong hash (bcrypt, Argon2) for passwords, and for transmission use HTTPS with proper authentication.
No. All encoding and decoding runs entirely in your browser, nothing is transmitted to any server or stored anywhere. This is important for any sensitive text you might be Base64-encoding, such as API tokens or credentials passed in headers.
If decoded text appears garbled, the original data was not plain text, it was binary data (an image, a compressed file, a compiled binary). Base64 decoding always produces the original bytes; if those bytes are not valid UTF-8 text, they cannot be rendered as readable characters. This tool handles UTF-8 text; binary file decoding requires a separate file-download step.
Both are text-safe encoding schemes but for different purposes. Base64 converts any bytes to a 64-character alphabet suitable for embedding in text formats like JSON or email. encodeURIComponent (percent-encoding) converts characters not allowed in URLs to their %XX hex equivalents, preserving the URL structure. Use Base64 for embedding data; use percent-encoding for URL parameters. You can use the [URL Encoder / Decoder](/url-encoder-formatter/) for percent-encoding.
A JWT (JSON Web Token) has three Base64URL-encoded parts separated by dots: header.payload.signature. To inspect the claims, Base64-decode the second part (the payload). Replace any - with + and _ with / before decoding (JWT uses URL-safe Base64). Note that decoding a JWT does not verify its signature, never trust JWT claims without signature verification on the server side.
Also known as
base64 encodebase64 decodeencode to base64decode base64 stringbase64 converterbtoa atob online