Base64 Encoder & Decoder

Encode text to Base64 or decode Base64 data in your browser for development, APIs and data handling.

Ad space — place a responsive AdSense unit here after approval.

Base64 Encoder & Decoder online

Base64 turns text and binary data into a safe, printable ASCII string. Use this tool to encode text to Base64 or decode a Base64 string back — for API payloads, data URIs, tokens and everyday development work.

Quick answer: Paste text or Base64 data and select the corresponding encode or decode operation.

How it works

Base64 works on bytes. Your text is first converted to its UTF-8 bytes; the encoder then takes those bytes three at a time (24 bits) and splits them into four 6-bit groups. Each group indexes a 64-character alphabet (A–Z, a–z, 0–9, + and /), so every 3 bytes become 4 characters and the output is about 33% larger than the input. When the final group holds only 1 or 2 bytes, the missing positions are filled with = padding — which is why Base64 strings so often end in = or ==. Decoding reverses the mapping exactly. A URL-safe variant swaps + for - and / for _ so results can travel inside URLs and filenames; JSON Web Tokens use that variant for their header and payload segments.

Worked example

Encoding the word hello: its 5 bytes (104, 101, 108, 108, 111) form one full 3-byte group plus a 2-byte remainder, producing aGVsbG8= — 8 characters with a single padding =. Encoding DailyWebKit (11 bytes) gives RGFpbHlXZWJLaXQ=, 16 characters. The output length is always a multiple of 4; if a string you are decoding is not, it has been truncated or was never Base64.

How to use this tool

  1. Paste the text (to encode) or the Base64 string (to decode) into the input box.
  2. Choose the Encode or Decode operation.
  3. Run the tool and check the output — the decoder rejects characters outside the Base64 alphabet.
  4. Copy the result into your header, payload or document.

Common uses

Developers encode with Base64 to embed small images as data URIs in CSS or HTML, to build Basic authentication headers, to carry attachments in email (MIME), and to inspect the header and payload of a JSON Web Token. It also shows up in API responses, Kubernetes secrets and data exports — anywhere binary or non-ASCII data must pass through a text-only channel.

Privacy and browser processing

Everything runs in your browser: the text you paste is converted locally and is never uploaded to a server.

Frequently asked questions

Is Base64 a form of encryption?

No. Base64 is an encoding, not encryption — anyone can decode it instantly without a key. It makes data safe to transport through text-only channels; it does not keep the data secret. If the content is sensitive, encrypt it first and encode the result.

Why does my Base64 string end with = signs?

That is padding. The encoder works on 3 bytes at a time; when the input length is not a multiple of 3, one or two = characters are appended so the output length becomes a multiple of 4. A single = means the last group held 2 bytes; == means it held 1 byte.

Why does decoding fail or produce garbage?

Usually because the input contains characters outside the Base64 alphabet — stray spaces and line breaks from a pasted email are common culprits — or the string was truncated, or it is URL-safe Base64 using - and _ where this decoder expects + and /. Copy the complete string and strip surrounding whitespace.

Can I encode non-English text?

Yes. Your text is converted to UTF-8 bytes before encoding, so Chinese characters, accented letters and emoji all round-trip correctly, and decoding interprets the bytes as UTF-8 again.

Related tools

Ad space