Skip to main content

Base64 Encoder / Decoder

Convert text and files to and from Base64, with CJK and URL-safe support

Native support for Chinese and emoji - no garbled output or errorsSwitch between the standard and URL-safe alphabets, with optional paddingLive validation with byte counts, and a one-click swap of direction
Input size

Last updated: 2026-10-09

About this tool

Base64 maps binary data onto 64 printable characters, so images, attachments or credentials can travel through text-only channels. This tool offers both a text and a file mode: text mode handles Chinese and emoji correctly, while file mode turns any file into a Base64 string and can turn Base64 back into a downloadable file.

Features

Safe with multi-byte characters

The browser's native btoa only accepts single-byte characters and throws on Chinese text. This tool encodes the UTF-8 bytes instead, so Chinese, Japanese and emoji all round-trip correctly.

URL-safe variant

The + and / of standard Base64 need escaping inside URLs and filenames. Switch to the URL-safe alphabet to get - and _ instead, and optionally drop the trailing = padding.

Direct file encoding

In file mode, pick any file to get its Base64 string; paste Base64 back to restore and download the original file - handy for small images or config attachments.

Live format validation

While decoding, the input is checked in real time and failures are distinguished between "invalid format" and "not valid UTF-8", so you know exactly where to look.

How to use

  1. 1

    Pick a mode

    Choose Text for ordinary strings, or File to turn images and attachments into Base64.

  2. 2

    Pick a direction

    Encode turns the source into Base64, Decode restores the original. Swap flips input and output in one click.

  3. 3

    Adjust the options

    Use the URL-safe alphabet when embedding in URLs or JWTs; turn off "keep padding" if the target system rejects trailing equals signs.

  4. 4

    Copy or download

    Encoded output copies with one click; when decoding a file, download it straight to disk.

Options

Alphabet
Standard uses A-Z a-z 0-9 + / for maximum compatibility; URL-safe uses A-Z a-z 0-9 - _ so the result can sit directly in query strings and filenames.
Trailing padding
Base64 uses = to pad the length to a multiple of 4. Most systems want it, but some URL use cases drop it to save characters. This tool decodes either form.
Input tolerance
Decoding ignores line breaks and spaces, so wrapped Base64 copied out of code or logs can be pasted as-is without tidying it up first.

Common use cases

  • Embed small images or certificates inside JSON and YAML configs
  • Debug HTTP Basic auth headers by generating or checking the authorization value
  • Build a JWT payload, or inspect the claims inside an existing token
  • Turn an image into a data URI for inlining into HTML or CSS
  • Work out what a wrapped Base64 string in a log actually contains
  • Convert a file into plain text to send to a colleague over chat

FAQ

Questions you may have about this tool

Is Base64 encryption? Is it safe?

No, it is only an encoding. There is no key, so anyone can recover the original text. Never use it to protect passwords; its purpose is simply to let binary data pass safely through text-only channels.

Why does encoding Chinese fail elsewhere?

The browser's native btoa accepts single-byte characters only, and one Chinese character spans several bytes, so it throws. This tool runs the text through TextEncoder first, so Chinese and emoji work correctly.

Why does the output get longer?

Base64 represents 3 bytes with 4 characters, so the size grows to roughly 133%. That overhead is inherent to the encoding and cannot be avoided.

How does the URL-safe variant differ?

Standard Base64 uses + and /, both of which have special meaning in URLs and must be escaped. The URL-safe variant replaces them with - and _, so the result can go straight into query parameters or filenames.

Should I drop the trailing equals signs?

It depends on the target system. The padding aligns the length to a multiple of 4 and many decoders add it back automatically. Turn the switch off only if the system you are talking to explicitly requires unpadded output.

What does "not valid UTF-8" mean?

It means the input is valid Base64, but the decoded bytes do not form text - most likely the original content was an image or another binary file. Switch to file mode to decode and download it.

Is there a file size limit?

There is no hard limit, but encoding holds the whole payload in memory and inflates it to about 1.33 times the size. Keeping files under a few tens of MB keeps the browser responsive.

Are uploaded files stored anywhere?

No. Reading and encoding happen entirely in your browser with no network requests, which you can confirm in the Network panel of your dev tools.