Base64 Encoder — Encode Text or Files to Base64 Online
FreeEncode any text or file to Base64 instantly in your browser. Supports standard and URL-safe encoding. Free, no upload, no account.
What's next
Settings guide
Encoding variants:
- ·Standard Base64 — Uses
+and/characters with=padding. Required for MIME email, most file encodings, and any context that does not pass the string through a URL. - ·URL-safe Base64 — Replaces
+with-and/with_. Removes or makes optional the=padding. Required for JWT tokens, OAuth state parameters, and any encoded data passed in a URL query string or path segment.
Line wrapping:
- ·No wrapping — Single-line output. Standard for API payloads, JSON values, and programmatic use.
- ·76 characters (MIME) — Line breaks every 76 characters. Required by RFC 2045 for email attachments encoded in MIME format.
Format comparison
Base64 vs hex encoding: Both represent binary as ASCII text. Base64 produces ~33% overhead (3 bytes → 4 characters); hex produces ~100% overhead (1 byte → 2 characters). Base64 is the right choice when size matters. Hex is more readable for byte-by-byte inspection and is standard for hash outputs and cryptographic keys.
Base64 vs encryption: Base64 is encoding, not encryption. It is trivially reversible by anyone — atob() in any browser decodes it instantly. Never use Base64 to obscure sensitive data. It exists to safely transport binary data through text channels, not to protect it.
How it works
Input
Paste text or upload a binary file. Text is converted to its UTF-8 byte representation before encoding.
Group bytes
The byte sequence is divided into 3-byte groups. Each group of 24 bits is split into four 6-bit values.
Map to characters
Each 6-bit value (0–63) maps to one of 64 printable ASCII characters: A–Z, a–z, 0–9, + and /. Padding characters = are added when the input length is not a multiple of 3.
Copy the result
The encoded string is ready to paste into an HTTP header, JSON field, CSS data URI, or wherever it is needed. Select standard or URL-safe output based on the destination.
About this format
Base64 encoding converts binary data — and by extension, any text — into a string of 64 printable ASCII characters. The encoded string is safe to embed anywhere that only accepts text: HTTP headers, JSON values, CSS data URIs, HTML attributes, and email bodies.
Common encoding tasks: generating the `Authorization: Basic` header for HTTP authentication (Base64 of `username:password`), creating CSS data URIs for embedding small images without a separate HTTP request, encoding a file attachment for an email API, or embedding binary data in a JSON payload.
Enter text or upload a file — the Base64 output appears immediately.