Encode text to Base64 or decode Base64 to text.
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.
data:image/png;base64,...Basic base64(user:pass)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.
// 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)));
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')
import "encoding/base64"
// Encode
encoded := base64.StdEncoding.EncodeToString([]byte("Hello, World!"))
// "SGVsbG8sIFdvcmxkIQ=="
// Decode
decoded, err := base64.StdEncoding.DecodeString("SGVsbG8sIFdvcmxkIQ==")
// []byte("Hello, World!")
# Encode
echo -n 'Hello, World!' | base64
# SGVsbG8sIFdvcmxkIQ==
# Decode
echo 'SGVsbG8sIFdvcmxkIQ==' | base64 --decode
# Hello, World!
# Encode a file
base64 image.png > image.b64
+ 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.
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.