Encoding

Base64 Encoder / Decoder – Free Online Base64 Converter

Convert plain text to Base64 or decode Base64 strings back to readable text — in real time, with full Unicode and emoji support. Toggle URL-safe mode for use in URLs and filenames. Everything runs locally in your browser.

Input82 B78 chars
Output112 B112 chars
Overhead+36.6%

78 characters · 82 bytes

112 characters · 112 bytes

Privacy: All encoding and decoding runs locally in your browser using the native btoa() / atob() APIs. Your data is never sent to a server.

What Is Base64 Encoding?

Base64 is a binary-to-text encoding scheme that converts arbitrary binary data into a string made up of 64 printable ASCII characters — the uppercase and lowercase Latin alphabet, digits 0–9, and the symbols + and /. Every 3 bytes of input are converted to 4 Base64 characters, so the encoded string is always approximately 33% larger than the original. A padding character (=) is appended when the input length is not a multiple of 3.

Base64 is not encryption — it is a reversible encoding that anyone can decode. Its purpose is to safely transport binary data across channels that only handle text, such as email (MIME), JSON APIs, HTML attributes, and HTTP headers.

How This Encoder/Decoder Works

JavaScript's built-in btoa() and atob() functions only handle Latin-1 (code points 0–255). Passing an emoji or accented character directly throws a InvalidCharacterError. This tool solves that with a two-step approach:

  1. Encode path: TextEncoder converts the input string to a UTF-8 Uint8Array, which is then converted to a Latin-1 binary string so btoa() can safely process it.
  2. Decode path: atob() produces a binary string, which is converted back to a Uint8Array and decoded using TextDecoder, correctly reconstructing any UTF-8 text including emoji.

Standard vs URL-Safe Base64

Standard Base64 uses + and /, which are special characters in URLs. The URL-safe variant (RFC 4648 §5) replaces those with - and _, and strips trailing = padding. This makes the encoded string safe to embed directly in URLs, filenames, and HTTP headers without percent-encoding. Enable the toggle in the tool to switch modes.

Common Use Cases

  • Data URLs — embed images directly in HTML/CSS as data:image/png;base64,…
  • HTTP Basic Auth — credentials are sent as Base64-encoded username:password
  • JWT tokens — the header and payload sections of a JSON Web Token are Base64url-encoded
  • Email attachments — MIME uses Base64 to encode binary files for text-based email transport
  • API payloads — encode binary blobs (files, icons) to pass them inside JSON strings

How to Use the Base64 Encoder / Decoder

  1. 1

    Choose a mode

    Click Encode to convert plain text into Base64, or Decode to convert a Base64 string back into readable text. The label on both panels updates to reflect the selected mode.

  2. 2

    Type or paste your input

    Enter any text in the left panel. For encoding, this can include Unicode characters, emoji, and accented letters — the tool handles all of them correctly via the TextEncoder API.

  3. 3

    Read the real-time output

    The right panel updates as you type with no button press needed. The stats bar shows input bytes, output bytes, and the size overhead (encoding always adds ~33%).

  4. 4

    Toggle URL-safe mode if needed

    Enable the URL-safe toggle to get a Base64 string using - and _ instead of + and / with no padding — safe to paste directly into URLs, filenames, or HTTP headers.

  5. 5

    Copy or Swap

    Click Copy to send the output to your clipboard. Use Swap to push the output back to the input and automatically flip the mode — useful for round-trip verification.

Frequently Asked Questions

Is Base64 the same as encryption?+

No. Base64 is encoding, not encryption. It converts binary data to a text representation using a fixed alphabet — anyone who has the Base64 string can decode it back to the original. Never use Base64 to protect sensitive data. For security, use proper encryption algorithms like AES-256.

Why does my Base64 string end with = or ==?+

Base64 encodes 3 bytes at a time into 4 characters. If your input length is not a multiple of 3, padding characters (=) are appended to make the output length a multiple of 4. One = means 1 byte of padding was added; == means 2 bytes. Padding is required by the standard but can be safely stripped in the URL-safe variant.

Is my data sent to a server when I use this tool?+

No. The entire encoding and decoding process runs in your browser using JavaScript's native btoa() and atob() APIs via TextEncoder / TextDecoder. No network request is made. Your data stays on your device and is never stored anywhere.