DevToolsForYou
Private by defaultRuns in your browser

Base64 encoder / decoder

Convert plain text, JSON, and Unicode content to and from Base64 in a focused workspace built for quick copy, swap, and retry flows.

Quick samplesUseful for testing
Base64 Encode/Decode

About this tool

Base64 is a binary-to-text encoding scheme that represents data using 64 printable ASCII characters. It was originally designed to safely carry binary content — such as images or files — through systems that only handle plain text, like email protocols. Today it is one of the most common encoding techniques in software development. You will encounter Base64 everywhere: API authentication headers encode credentials as Authorization: Basic <base64>. JSON Web Tokens encode their header and payload sections with Base64url. HTML and CSS data URLs embed images directly in source code using Base64. Configuration files, environment variables, and CI/CD pipelines store secrets and certificates in Base64 form to avoid whitespace and special-character issues. This tool encodes and decodes UTF-8 text fully in your browser — nothing you paste is sent to any server. It handles plain text, JSON objects, and Unicode strings including emoji and non-Latin scripts without any extra setup.

No signup requiredRuns in your browserInstant results
How to use
  1. 1

    Paste your plain text, JSON, or binary data into the input field.

  2. 2

    Select Encode to convert it to Base64, or Decode to convert a Base64 string back to its original form.

  3. 3

    The result appears instantly in the output field — no button press needed.

  4. 4

    Click Copy to copy the output to your clipboard, or Swap to flip input and output.

Why use this tool?
  • Encode API payload samples before sharing them in docs or tests.

  • Decode Base64 values copied from tokens, logs, or browser storage.

  • Handle Unicode text safely instead of relying on ASCII-only helpers.

ExamplesInput → output

Encode a plain string

InputHello, world!
OutputSGVsbG8sIHdvcmxkIQ==

Encode a JSON payload

Input{"user":"alice","role":"admin"}
OutputeyJ1c2VyIjoiYWxpY2UiLCJyb2xlIjoiYWRtaW4ifQ==

Decode a Base64 string

InputSGVsbG8sIHdvcmxkIQ==
OutputHello, world!
Common errorsAnd how to fix them

Invalid Base64 string

Cause: You pasted plain text (e.g. a sentence or JSON) into the Decode field instead of an actual Base64 value.

Fix: Switch the operation to Encode. Decode only accepts valid Base64 strings like SGVsbG8sIHdvcmxkIQ==.

Incorrect padding — extra or missing = characters

Cause: The Base64 string was truncated or modified. Base64 output length must be a multiple of 4, padded with = characters.

Fix: Use the complete Base64 string. If you copied it from a URL, the = signs may have been stripped — add them back or try decoding with the URL-safe variant.

Garbled output when decoding binary files

Cause: This tool is designed for text. Decoding a Base64-encoded binary (e.g. a PDF or image) produces the raw bytes as a string, which appears as garbled characters.

Fix: Use a file-specific Base64 decoder to reconstruct binary files. This tool is best suited for text, JSON, and credential payloads.

Frequently asked questionsCommon questions answered

These answers explain common base64 encode/decode tasks, expected input formats, and edge cases so both visitors and search engines can understand what this tool does.

What is Base64 used for?

Base64 is commonly used to safely transport binary or text data through systems that expect plain text, such as API payloads, tokens, email content, and data URLs.

Can this Base64 tool handle Unicode text?

Yes. This tool encodes and decodes UTF-8 text, so values containing characters like emoji or non-Latin scripts are handled correctly instead of being limited to ASCII only.

Why does Base64 decode fail for a normal sentence?

Decode expects an actual Base64 value. If you paste plain text like a sentence or JSON that has not been encoded yet, the tool will reject it and you should switch to Encode instead.

Does Base64 encryption protect sensitive data?

No. Base64 is an encoding format, not encryption. It changes how data is represented, but anyone can decode it back to the original content.

Code examplesUse this tool in your code

In browsers use btoa() and atob(). In Node.js use Buffer. For Unicode safety in the browser, encode via TextEncoder first.

JavaScript / Node.jsBrowser
// Encode
const encoded = btoa("Hello, world!");
console.log(encoded); // SGVsbG8sIHdvcmxkIQ==

// Decode
const decoded = atob("SGVsbG8sIHdvcmxkIQ==");
console.log(decoded); // Hello, world!

// Unicode-safe encode (handles emoji, non-ASCII)
function encodeUnicode(str) {
  return btoa(
    String.fromCharCode(...new TextEncoder().encode(str))
  );
}

// Unicode-safe decode
function decodeUnicode(b64) {
  return new TextDecoder().decode(
    Uint8Array.from(atob(b64), (c) => c.charCodeAt(0))
  );
}
See full JavaScript / Node.js examples →