SimplyCalculated.org

Base64 Encoder & Decoder

Type or paste text on either side to instantly encode it to Base64 or decode it back to plain text — updates live as you type, with full support for emoji and non-Latin scripts. Everything runs locally in your browser.

100% private: everything is processed in your browser's memory — nothing you enter is uploaded to a server, logged, or stored.

Base64 Encoder & Decoder

What Is Base64 Encoding?

Base64 is a binary-to-text encoding scheme: it takes arbitrary binary data (raw bytes) and represents it using only 64 printable ASCII characters — uppercase and lowercase letters, digits, and two symbols (typically + and /), with = used as padding at the end. It exists because many older systems and protocols (email, some text-based network protocols, certain markup and config formats) were designed to safely carry plain text but can corrupt or reject raw binary bytes — Base64 sidesteps that problem entirely by re-expressing binary data as ordinary text.

Base64 is not encryption, and it is not a security mechanism. This point trips up a lot of people, so it's worth stating plainly: encoding is a reversible, publicly documented transformation with no secret key involved. Anyone — or any tool, including this one — can decode a Base64 string back to its original content in a single step. If you need to keep data confidential, you need actual encryption (such as AES or TLS), not Base64. Base64's job is compatibility and safe transport, not secrecy.

Common Use Cases

  • Data URIs: embedding small images, fonts, or icons directly inside CSS or HTML (e.g. data:image/png;base64,iVBORw0KGgo...) instead of a separate file request.
  • Email attachments (MIME): email was originally a text-only protocol, so binary attachments like images and documents are Base64-encoded before being embedded in a message body.
  • Binary data inside JSON or XML: both formats are text-based and can't natively hold raw binary bytes, so APIs often Base64-encode binary fields (file uploads, cryptographic signatures, thumbnails).
  • HTTP Basic Authentication: the Authorization: Basic header carries a Base64-encoded username:password string (again — encoded, not encrypted, which is why Basic Auth requires HTTPS to be safe).
  • URL-safe data transport: tokens, session identifiers, and JWTs often use a URL-safe variant of Base64 so the encoded value can appear directly in a URL or query string.

The Standard: RFC 4648

This tool implements standard Base64 as defined in RFC 4648, the IETF specification that also defines the URL-safe and Base32 variants. Standard Base64 groups input bytes into 3-byte chunks and maps each chunk to 4 output characters drawn from the alphabet A–Z, a–z, 0–9, +, and /, padding the final group with = characters when the input length isn't an exact multiple of 3 bytes. Text input is first converted to UTF-8 bytes, which is what makes multi-byte characters like emoji and accented or non-Latin letters encode and decode correctly.

Step-by-Step: How Encoding Works Under the Hood

It helps to see the mechanics once, even though the tool above does all of this instantly. Take the three-character string "Hi!":

  1. Convert each character to its byte value: H = 72, i = 105, ! = 33. In binary (8 bits each), that's 01001000 01101001 00100001.
  2. Because a 3-byte input maps cleanly onto Base64's 4-character output, regroup those 24 bits into four 6-bit chunks: 010010 000110 100100 100001.
  3. Each 6-bit chunk is a number from 0–63, which indexes directly into the Base64 alphabet (A–Z = 0–25, a–z = 26–51, 0–9 = 52–61, + = 62, / = 63). The four chunks above are 18, 6, 36, 33 — which map to S, G, k, h.
  4. Result: "Hi!" encodes to SGkh. Since 3 input bytes divided evenly into 4 output characters with nothing left over, no = padding is needed here — padding only appears when the final group has 1 or 2 leftover input bytes instead of 3.

Decoding just runs this process in reverse: look up each character's 6-bit value, concatenate them back into a stream of bits, and regroup that stream into 8-bit bytes to recover the original text. This tool does exactly that using the browser's built-in TextEncoder/TextDecoder and btoa/atob APIs, so the math above runs natively rather than in a slow, hand-rolled loop.

Base64 vs. Related Encodings

Base64 is one of several ways to represent binary or special data as plain text, and it's easy to conflate it with the others — here's how the common ones actually differ:

Encoding Purpose Size overhead
Base64 Safely carry arbitrary binary data through text-only channels ~33% larger
URL / percent-encoding Make text safe inside a URL by escaping reserved characters Varies (0–200%+ depending on content)
Hexadecimal Human-readable byte-for-byte representation, common in hashes/checksums 100% larger (2 hex characters per byte)
Encryption (e.g. AES) Actually protect data confidentiality with a secret key Varies by algorithm/mode

Base64 is the most space-efficient of the plain-text encodings above, which is why it's the default choice for embedding binary data (images, files, tokens) inside text formats — but note that it's the only row in this table without any confidentiality guarantee at all, encryption included by definition, the others by design intent.

Example Reference Table

Plain Text Base64
helloaGVsbG8=
Hello, World!SGVsbG8sIFdvcmxkIQ==
SimplyCalculatedU2ltcGx5Q2FsY3VsYXRlZA==
aYQ==

Paste any of the plain-text values above into the tool to confirm the Base64 output matches, or paste a Base64 value to confirm it decodes back to the original text.

Troubleshooting & Practical Tips

Why Decoding Sometimes Fails

Standard Base64 only accepts a very specific set of characters, so decoding fails whenever the input strays outside it. The usual culprits:

  • Stray whitespace or line breaks: copying from an email client or PDF can introduce invisible line-wrap characters in the middle of the string.
  • Missing padding: valid standard Base64 length is always a multiple of 4 characters; if a system stripped the trailing = padding, decoding can fail or silently misbehave.
  • The URL-safe variant: if the string uses - and _ instead of + and /, it's URL-safe Base64 (per RFC 4648 §5), not standard Base64 — swap the characters back before decoding here.
  • Truncated copy-paste: a partially copied string will produce garbled or failed output because every group of 4 characters must be complete.

A Reminder on Security

Because decoding requires no key or password, never rely on Base64 to hide sensitive information such as passwords, API keys, or personal data in a URL, config file, or source code — treat anything Base64-encoded as fully readable by anyone who has it.

Frequently Asked Questions

Is Base64 encoding the same thing as encryption?
No — this is the most common misconception about Base64. Base64 is a binary-to-text encoding scheme, not encryption or a security measure. It uses a fixed, publicly known alphabet and no secret key, so anyone can decode a Base64 string back to its original form in one step, with no password required. Never use Base64 alone to protect sensitive data like passwords or personal information; use real encryption (e.g. AES) for that, and reserve Base64 for making binary data safe to transmit through text-only channels.
Why does Base64-encoded text look longer than the original?
Base64 represents every 3 bytes of input as 4 output characters, so encoded text is roughly 33% larger than the original. This overhead is the trade-off for guaranteeing that the output only uses printable ASCII characters (A–Z, a–z, 0–9, +, /, and = for padding) that survive transport through systems designed for text, like email and JSON.
Why did decoding my Base64 string fail?
The most frequent causes are: extra whitespace or line breaks copied in accidentally, missing padding "=" characters at the end (standard Base64 length must be a multiple of 4), or the string actually being URL-safe Base64, which swaps "+" for "-" and "/" for "_". Our decoder will show a specific error message rather than failing silently — check the message, remove stray whitespace, and swap any "-"/"_" characters back to "+"/"/" if you suspect the URL-safe variant.
What is URL-safe Base64 and how is it different?
Standard Base64 uses "+" and "/" in its alphabet, but both characters have special meaning inside a URL query string, so a URL-safe variant (defined alongside standard Base64 in RFC 4648) replaces them with "-" and "_" respectively, and often omits the trailing "=" padding entirely. If you have a Base64 string sourced from a URL, JWT, or web token and it fails to decode here, try converting "-" back to "+" and "_" back to "/" first.
Can Base64 encode images and other binary files, not just text?
Yes — Base64 was designed for exactly this. Any binary data (images, PDFs, audio) can be Base64-encoded into a plain-text string, which is how data URIs (e.g. embedding a small image directly inside CSS or HTML with `data:image/png;base64,...`) and MIME email attachments work. This tool is built for text input/output, but the same encoding math applies to file bytes.
Does this tool send my text to a server?
No. All encoding and decoding happens entirely in your browser using built-in JavaScript APIs — nothing you type is uploaded, logged, or stored anywhere. This is safe for pasting internal or sensitive strings during debugging, though remember that Base64 itself provides no confidentiality (see above).
Does this tool support emoji and non-English characters?
Yes. Text is converted to UTF-8 bytes before Base64 encoding, so emoji, accented letters, and non-Latin scripts (Chinese, Arabic, Cyrillic, etc.) all round-trip correctly. Some older or naively implemented Base64 tools only handle single-byte ASCII correctly and will corrupt multi-byte characters — this one does not.