Base64 Encoder/Decoder

Encode text to Base64 or decode Base64 to text.

What is Base64 Encoding?

Base64 is a binary-to-text encoding scheme that represents binary data using a set of 64 ASCII characters: uppercase letters (A-Z), lowercase letters (a-z), digits (0-9), plus (+), and slash (/). The equals sign (=) is used as padding. It was originally designed for safely transmitting binary data through systems that only support text, such as email (MIME) and early HTTP protocols.

The encoding works by taking every 3 bytes (24 bits) of input and splitting them into four 6-bit groups. Each 6-bit group maps to one of the 64 characters in the Base64 alphabet. If the input length is not a multiple of 3, padding characters are appended. This means Base64-encoded data is always approximately 33% larger than the original.

A key point developers should understand: Base64 is encoding, not encryption. It provides zero security. Anyone can decode a Base64 string instantly. It exists purely for data transport compatibility, not for protecting sensitive information.

Common Use Cases

How to Use This Tool

  1. 1. Paste your text or Base64 string into the input field above
  2. 2. Click "Encode to Base64" to convert plain text into Base64, or click "Decode from Base64" to convert a Base64 string back to plain text
  3. 3. Copy the result using the "Copy to clipboard" button

This tool handles UTF-8 text correctly, including special characters, accented letters, and emoji. All processing happens locally in your browser -- no data is sent to any server.

Base64 in Different Languages

JavaScript
// Encode
const encoded = btoa('Hello, World!');
// "SGVsbG8sIFdvcmxkIQ=="

// Decode
const decoded = atob('SGVsbG8sIFdvcmxkIQ==');
// "Hello, World!"

// For UTF-8 (handles unicode)
const utf8Encode = btoa(unescape(encodeURIComponent('Caf\u00e9')));
const utf8Decode = decodeURIComponent(escape(atob(utf8Encode)));
Python
import base64

# Encode
encoded = base64.b64encode(b'Hello, World!').decode('utf-8')
# "SGVsbG8sIFdvcmxkIQ=="

# Decode
decoded = base64.b64decode('SGVsbG8sIFdvcmxkIQ==').decode('utf-8')
# "Hello, World!"

# Encode a file
with open('image.png', 'rb') as f:
    file_b64 = base64.b64encode(f.read()).decode('utf-8')
Go
import "encoding/base64"

// Encode
encoded := base64.StdEncoding.EncodeToString([]byte("Hello, World!"))
// "SGVsbG8sIFdvcmxkIQ=="

// Decode
decoded, err := base64.StdEncoding.DecodeString("SGVsbG8sIFdvcmxkIQ==")
// []byte("Hello, World!")
Command Line (bash)
# Encode
echo -n 'Hello, World!' | base64
# SGVsbG8sIFdvcmxkIQ==

# Decode
echo 'SGVsbG8sIFdvcmxkIQ==' | base64 --decode
# Hello, World!

# Encode a file
base64 image.png > image.b64

Frequently Asked Questions

What is Base64 encoding?
Base64 is a binary-to-text encoding scheme that converts binary data into a set of 64 ASCII characters (A-Z, a-z, 0-9, +, /). It is commonly used to safely transmit binary data over text-based protocols like HTTP, email (MIME), and JSON. Base64 increases the size of data by approximately 33%.
Is Base64 the same as encryption?
No. Base64 is encoding, not encryption. It provides no security whatsoever. Anyone can decode a Base64 string back to its original form instantly. It is designed for data transport, not data protection. If you need to protect sensitive data, use proper encryption like AES or TLS.
Why does Base64 increase data size?
Base64 represents every 3 bytes of binary data as 4 ASCII characters, resulting in approximately 33% overhead. Additionally, padding characters (=) may be added to ensure the output length is a multiple of 4. This trade-off is necessary to safely transmit binary data through text-only channels.
What is the difference between Base64 and Base64url?
Standard Base64 uses + and / characters, which are not URL-safe. Base64url (RFC 4648) replaces these with - and _, making the output safe for use in URLs and filenames. JWT tokens use Base64url encoding for this reason.

Monitor your APIs

Ensure your endpoints are responding correctly with UptimeSignal. Get alerted when your API goes down.

Start monitoring free →

25 monitors free. No credit card required.

Related Developer Tools