WordCounter

Base64 Encode / Decode

Base64 encode decode online tool. Convert text to Base64 and decode Base64 to UTF-8 text with auto-detect direction and URL-safe formatting.

Direction:
0 chars
UTF-8 Unicode Compliant0 chars

The Essential Online Base64 Encode Decode Tool: From Binary to Clean Text

In contemporary web development, cybersecurity, and cloud microservices, transferring binary data across text-only protocols is a constant requirement. Whether you are generating Basic Authentication HTTP headers, inspecting JSON Web Tokens (JWT), embedding SVG images directly into HTML data URIs, or troubleshooting API payloads, you need a dependable base64 encode decode tool. Our free online base64 encode decode utility provides two-way translation, complete UTF-8 Unicode support, and automatic URL-safe conversions.

The 6-Bit Chunking Mathematics of Base64

Standard computer memory stores data in 8-bit octets (bytes). Base64 solves the problem of transmitting arbitrary bytes across 7-bit ASCII systems by dividing binary data into 6-bit chunks:

  • Bit Grouping: Because $2^6 = 64$, every 6-bit binary integer corresponds to exactly one of 64 printable characters: A–Z (indices 0–25), a–z (indices 26–51), 0–9 (indices 52–61), + (index 62), and / (index 63).
  • The 3-to-4 Ratio: Every 3 bytes of binary data (24 bits) are mapped into 4 Base64 ASCII characters. As a result, Base64 increases data size by approximately 33%.
  • Equal Sign Padding (=): If the input byte length is not divisible by 3, one or two trailing = padding characters are appended to round out the 4-character block.

Standard Base64 vs. URL-Safe Base64

Standard Base64 is ideal for email attachments and HTTP request headers, but causes severe bugs when placed inside web addresses. In standard Base64:

  • The plus sign (+) is treated as an encoded space character by web servers.
  • The forward slash (/) is parsed as a URL directory separator.
  • The padding equals sign (=) separates URL query parameter keys and values.

URL-Safe Base64 (RFC 4648 §5) solves this by replacing + with hyphen (-), / with underscore (_), and omitting padding equals signs. This format is mandatory for OAuth2 tokens, JWT signatures, and RESTful API slugs.

Base64 Encoding Sample Reference Table

Plaintext InputUTF-8 Byte CountStandard Base64 OutputURL-Safe Base64 Output
Hello World11 BytesSGVsbG8gV29ybGQ=SGVsbG8gV29ybGQ
user:password12316 BytesdXNlcjpwYXNzd29yZDEyMw==dXNlcjpwYXNzd29yZDEyMw
Café ☕8 BytesQ2Fmw6kg4piVQ2Fmw6kg4piV
<svg></svg>11 BytesPHN2Zz48L3N2Zz4=PHN2Zz48L3N2Zz4

Related Topics & Search Queries: base64 encode/decode.

Frequently Asked Questions

What is Base64 encoding and how does this base64 encode decode tool work?

Base64 is a binary-to-text encoding scheme that translates raw binary data into a set of 64 printable ASCII characters (A–Z, a–z, 0–9, +, and /). Our online base64 encode decode tool converts plain text to Base64 and decodes Base64 strings back to text instantly with full Unicode UTF-8 support.

Why do developers use Base64 encode decode in web applications?

Many legacy network protocols—such as HTTP headers, email protocols (SMTP/MIME), and JSON payloads—were engineered strictly for printable ASCII text. Base64 allows binary data (such as image files, cryptographic signatures, Basic Auth credentials, and JWT tokens) to travel safely across text channels without data corruption.

Does this tool support non-Latin scripts, accented characters, and emojis?

Yes! Standard JavaScript `btoa()` crashes with an error when given multi-byte UTF-8 characters like emojis or Asian scripts. Our tool utilizes the modern `TextEncoder` and `TextDecoder` Web APIs, guaranteeing flawless encoding and decoding of international alphabets and emojis.

What is URL-safe Base64 and when should I use it?

Standard Base64 contains the characters "+" and "/", plus "=" for padding. In HTTP URLs and query strings, these characters have reserved meanings (+ becomes a space, / divides path routes). URL-safe Base64 substitutes "-" for "+" and "_" for "/", and strips the trailing "=" padding so strings can be placed directly into URLs and JWT tokens.

How does the auto-detect direction feature work?

Our tool analyzes your input string in real time. If the text matches standard Base64 patterns (consisting only of valid Base64 alphabet characters and proper 4-character padding blocks), it automatically decodes it to plain text. Otherwise, it encodes your plain text into Base64 without requiring manual mode toggling.