Free online Base64 encoder and decoder

Encode text to Base64 or decode Base64 to plain text—runs in your browser.

  • No upload
  • Instant convert
  • Free

How this tool fits your workflow

More in this category →

What Base64 encoding actually does

Base64 converts binary data into a string of 64 printable ASCII characters (A-Z, a-z, 0-9, +, /). The name comes from the 64-character alphabet used. Every 3 bytes of input become 4 Base64 characters, expanding the data size by approximately 33%. Padding characters (=) fill the last group when the input is not a multiple of 3 bytes.

The encoding exists because many systems — email protocols, HTTP headers, JSON fields — were designed for plain text and cannot safely carry arbitrary binary data. Base64 gives binary data a text-safe representation that passes through these systems without corruption.

Base64 is not encryption

This is the most common misconception about Base64. It is an encoding scheme, not a security mechanism. Anyone can decode Base64 instantly without a key or password. Storing a password or API secret as a Base64 string does not protect it — it only obscures it from casual inspection.

For actual security, use encryption (AES-256, RSA) or cryptographic hashing (bcrypt, Argon2 for passwords; SHA-256 for data integrity). Reserve Base64 for its intended purpose: encoding binary data for text-based transport.

Common use cases

Email attachments use Base64 (via MIME) to embed binary files inside plain-text email messages. Web developers use Base64 data URIs to inline small images or fonts directly in CSS and HTML, eliminating extra HTTP requests. REST APIs that exchange binary data (audio clips, generated images, PDF previews) often Base64-encode the payload inside a JSON string field to avoid multipart encoding complexity.

HTTP Basic Authentication sends credentials as Base64-encoded "username:password". While this looks obfuscated, it is trivially decodable — it relies on HTTPS for actual security, not the Base64 layer. JSON Web Tokens (JWTs) also use Base64url (a URL-safe variant) to encode their header and payload sections.

URL-safe Base64 replaces + with - and / with _ to make encoded strings safe in URLs and filenames. This variant is used in JWTs, OAuth tokens, and URL parameters. The standard encoder on this page uses the standard alphabet; switch to URL-safe mode if you need the variant for web contexts.

Debugging Base64 problems

A common issue is line breaks: some Base64 implementations insert newlines every 76 characters (MIME standard). When pasting into a decoder, strip line breaks first. Another issue is the URL-safe vs standard alphabet: if your encoded string contains - or _, it uses URL-safe Base64 — swap those characters back to + and / before decoding with a standard decoder.

Incorrect padding is another frequent error. Base64 strings must have length divisible by 4. If yours is not, add = characters at the end until it is. Most decoders handle missing padding automatically, but strict implementations throw errors. The browser's atob() function, for example, requires valid padding.

Frequently asked questions

Is Base64 the same as encryption?
No. Base64 is an encoding scheme, not encryption. It converts binary data to ASCII text for safe transport. Anyone can decode Base64 without a key. Do not use it to protect sensitive data.
What is Base64 commonly used for?
Base64 is used in email attachments (MIME), embedding images in HTML and CSS, storing binary data in JSON APIs, and encoding credentials in HTTP Basic Auth headers.
Is my data sent to a server when I encode or decode?
No. All encoding and decoding runs locally in your browser. Your data is never uploaded to any server.
Why does my Base64 string end with == or =?
Base64 encodes 3 bytes as 4 characters. When the input is not a multiple of 3 bytes, padding characters (=) are added to make the output length a multiple of 4.