Base64 Encoder & Decoder

Two-way Base64 encoder and decoder in your browser. Converts UTF-8 text (including non-ASCII characters and emojis) to Base64 strings via TextEncoder and btoa(), or decodes Base64 payloads back to UTF-8 text via atob() and TextDecoder with malformed-input error validation.

38 chars
Client-Side Processing. Strings are encoded and decoded locally using browser Web APIs.
Advertisement

How to Use Base64 Encoder & Decoder

Click **Encode to Base64** or **Decode from Base64** at the top and type or paste your string into the left input box (`Plain Text to Encode` or `Base64 String to Decode`). To handle accented letters, non-Latin scripts, and emojis accurately without `Character Out Of Range` exceptions, the encoder first converts your string into a UTF-8 byte array via `new TextEncoder().encode()` before applying `btoa()`, while the decoder strips whitespace, runs `atob()`, and reconstructs UTF-8 characters via `new TextDecoder().decode()`. If a pasted string in Decode mode contains non-Base64 characters or corrupted padding, an error alert (`Invalid Base64 string`) appears immediately. Click **Swap** to flip the output into the input box and switch modes, or click **Copy** to copy the result. **Important:** Base64 is a reversible binary-to-text encoding scheme used for data transport—it is **not encryption or password protection**, and anyone can decode a Base64 string without a secret key. For URL query escaping or JSON formatting, see our URL Encoder & Decoder and JSON Formatter.

  1. 1

    Choose Encode to Base64 or Decode from Base64

    Select Encode to Base64 to convert plain text into Base64, or Decode from Base64 to read an encoded string.

  2. 2

    Type or Paste Your Input String

    Enter plain UTF-8 text, JSON, or a Base64 string into the left textarea (character count updates live).

  3. 3

    Inspect Live Output or Format Errors

    View the converted output in the right box, or check the error banner if a Base64 string is malformed.

  4. 4

    Click Swap or Copy Result

    Click Swap to reverse the conversion direction with your current output, or click Copy to copy to clipboard.

Worked Input & Output Example

Encoding Default UTF-8 Text With Em-Dash Punctuation Into Base64

TextEncoder converts multibyte UTF-8 characters (like the 3-byte em-dash "—") into raw bytes before Base64 radix-64 mapping.

1. Plain Text to Encode (38 chars)
Toolora — Everyday tools, made simple.

38 characters (40 UTF-8 bytes because "—" is 3 bytes: 0xE2 0x80 0x94).

2. UTF-8 Byte Stream → btoa()

new TextEncoder().encode(str) (40 bytes) → 6-bit Base64 groups with "=" padding.

Client-side calculation
3. Base64 Result (56 chars)
VG9vbG9yYSDigJQgRXZlcnlkYXkgdG9vbHMsIG1hZGUgc2ltcGxlLg==

Reversible via Decode from Base64 (TextDecoder restores the exact UTF-8 string).

Encoding StandardRFC 4648 Base64A–Z, a–z, 0–9, +, /, and =
Unicode PipelineTextEncoder UTF-8Supports symbols & emojis
Security NoticeEncoding ≠ EncryptionReversible without a key
Round-Trip Action1-Click SwapFlips Encode ↔ Decode

Related Free Tools

Explore more browser-based tools in Daily & Text Utilities or browse the complete All Tools Directory.