🔣 Base64 Encoder & Decoder

Encode text to Base64 and decode Base64 back to text. Standard and URL-safe modes.

About This Base64 Tool

What It Does

Base64 encoding converts binary data or text into a set of 64 ASCII characters — uppercase and lowercase letters, digits, plus and slash — making it safe to transmit through systems that only handle text. Every 3 bytes of input become 4 Base64 characters. This tool runs entirely in your browser using the built-in btoa() and atob() functions, so nothing is ever uploaded to a server. Standard mode produces the classic Base64 format, while URL-safe mode replaces + with - and / with _, and strips the trailing padding = signs, producing strings safe for use in URLs, query parameters, and filenames without percent-encoding.

Features

Common Use Cases

Developers use Base64 encoding to embed images directly in HTML or CSS with data URIs, avoiding extra HTTP requests for small icons and logos. API authentication often uses Base64 to encode credentials for HTTP Basic Auth headers. JSON Web Tokens (JWTs) encode their header and payload sections in Base64URL format. Email attachments in MIME format are Base64-encoded so binary files can travel through text-only email protocols. Configuration files and environment variables sometimes store certificates and keys in Base64 to avoid newline and escape character issues.

Tips

Use URL-safe mode when embedding Base64 in query parameters, URL paths, or JWT tokens. The standard mode is fine for data URIs and most API contexts. If you're decoding and getting garbled text, the input might be Base64-encoded binary (like a PDF or image) rather than text — this tool is designed for text-to-text encoding. For binary files, use a dedicated file-to-Base64 converter.

FAQ

Is Base64 encryption?

No. Base64 is encoding, not encryption — it's trivially reversible by anyone. Think of it as changing the alphabet, not locking anything. If you're storing passwords or sensitive data, use proper hashing (see our Hash Generator) or encryption. Base64 is for safe transport, not security.

Why does Base64 output look longer than my input?

Base64 expands data by roughly 33%. Every 3 bytes of input produce 4 Base64 characters. So a 300-character input becomes about 400 Base64 characters. This is the tradeoff for making binary data compatible with text-only systems.

What's the difference between standard and URL-safe Base64?

Standard Base64 uses +, /, and = for padding. These characters have special meanings in URLs (+ means space, / is a path separator, = is a query delimiter). URL-safe Base64 (RFC 4648 section 5) replaces + with -, / with _, and omits = padding entirely, making the output safe for URLs, filenames, and tokens without percent-encoding.

Can I encode images or files with this tool?

This tool is optimized for text-to-Base64 encoding. For binary files like images, PDFs, or audio, use a dedicated binary-to-Base64 tool that reads the raw bytes. If you paste binary data as text, it may get corrupted by character encoding issues.