Base64 Decode and Encode

Convert text and Base64 in both directions, directly in your browser. The decoder accepts standard and URL-safe alphabets and fixes missing padding; you can also turn a local file into Base64.

Mode

Whitespace and line breaks are ignored when decoding. URL-safe characters (- and _) are accepted.

Base64 is an encoding, not encryption. It simply represents bytes as safe ASCII characters and anyone can reverse it. Never use Base64 to protect passwords or secrets.

Encode a local file to Base64

The file is read in your browser and never uploaded. The Base64 text appears in the Result box; for large outputs only a preview is shown, but Copy and Download always use the full value.

How to use

  1. Paste your text or Base64 string into the Input box.
  2. Pick a mode: Decode turns Base64 into text, Encode turns text into Base64.
  3. Press Decode / Encode. The converted value appears in the Result box.
  4. Copy the result, download it as a .txt file, or send it back into the input for a round trip.

To encode a file, use the file picker under the converter. Its Base64 output lands in the same Result box.

Inputs and outputs

Decoding

Encoding

Limits

Frequently asked questions

What is Base64 used for?

Base64 represents binary data using only 64 printable ASCII characters, so it can travel through systems that only handle text safely: email attachments (MIME), data URLs in HTML and CSS, JSON web tokens, and API payloads that cannot carry raw bytes.

Is Base64 encryption?

No. It is a reversible encoding with no key — anyone can decode the output. Base64 protects nothing; it only changes how bytes are written down.

Why does my input fail to decode?

Three common reasons: an invalid character (anything outside A–Z, a–z, 0–9, +, /, -, _ and trailing =), a truncated string whose length cannot be repaired with padding, or mixing the standard and URL-safe alphabets. The error message names the character and its position when possible.

What is URL-safe Base64?

A variant that replaces + with - and / with _ so the output can be used in URLs and file names without escaping; padding is often omitted. The decoder here accepts both alphabets, with or without padding.

Why do I see "not valid UTF-8" and a hex preview?

Base64 can encode any bytes. When the decoded bytes do not form valid UTF-8 text, they are most likely binary data or text in another encoding (for example Latin-1). Instead of printing garbled characters, the tool explains this and shows the first bytes in hexadecimal so you can identify the data.

Can I encode a file into Base64?

Yes — use the file picker on this page for files up to 5 MiB. The file is read locally; only you see the result.

Is my text sent anywhere?

No. Conversion happens entirely in your browser with local JavaScript. The page loads no third-party scripts and makes no network requests with your input, so your data stays on your device.

Related tools