Text & Encoding

Base64 Encoder & Decoder

Encode and decode Base64 strings with full UTF-8 and Unicode accuracy.

Runs 100% locally in your browser
83 UTF-8 bytes

What Does the Base64 Encoder & Decoder Do?

The Base64 Encoder & Decoder translates arbitrary UTF-8 text into ASCII-safe Base64 strings (RFC 4648) and decodes Base64 payloads back into readable UTF-8 text.

Unlike naive implementations that call window.btoa() directly—which throws a DOMException on any character outside the Latin1 range—this tool encodes strings into raw UTF-8 byte arrays via TextEncoder and decodes via TextDecoder, preserving emojis, accented letters, and CJK scripts cleanly.

It also supports URL-safe Base64 (RFC 4648 §5), which substitutes '+' with '-' and '/' with '_' and optionally strips '=' padding.

How to Use This Tool

  1. Select 'Encode to Base64' or 'Decode from Base64' (or click 'Swap' at any time to reverse directions).
  2. Paste your plain text or Base64 string into the input box; choose Standard or URL-Safe alphabet if encoding.
  3. Copy the converted output or inspect the validation error if a Base64 string contains illegal characters.

Common Engineering Use Cases

  • Constructing HTTP Basic Authentication headers (Authorization: Basic <credentials>).
  • Inspecting decoded JSON Web Token (JWT) header or payload segments.
  • Embedding small configuration payloads or SVG data URIs safely inside environment variables or JSON fields.

Practical Developer Examples

UTF-8 String with Unicode Characters

Multi-byte characters are encoded as UTF-8 bytes prior to Base64 transformation.

Input
DevToolbox 🚀 — Free Forever
Output
RGV2VG9vbGJveCDwn5qAIOKAlCBGcmVlIEZvcmV2ZXI=

Common Mistakes & Pitfalls to Avoid

  • Confusing Base64 encoding with encryption—Base64 is a public, reversible encoding scheme that offers zero confidentiality.
  • Using standard Base64 directly in URL query parameters without URL-encoding '+' and '=' characters or switching to Base64url.
  • Calling browser btoa() on UTF-8 strings in application code without converting to a UTF-8 byte sequence first.

Frequently Asked Questions

Is Base64 a form of encryption?

No. Base64 is strictly a binary-to-text encoding scheme designed to transport bytes safely across text-only channels. Anyone can decode a Base64 string instantaneously without a key.