Skip to content
Raisalon

Developer tool

Base64 Encoder and Decoder

Encode text to Base64 or decode Base64 back to text, with full UTF-8 support and an optional URL-safe alphabet for tokens and URLs.

Direction

How to use it

Choose Encode to convert text into Base64, or Decode to turn Base64 back into text. The output updates as you type. Swap input and output moves the current result into the input box and reverses the direction, which is a quick way to check that a value round-trips correctly.

Enable URL-safe alphabet when the encoded value will appear in a URL, a filename, or a JSON Web Token. The decoder accepts both alphabets automatically, with or without padding.

What Base64 is for

Base64 represents arbitrary bytes using 64 printable ASCII characters. It exists so that binary data can travel through systems designed for text: email bodies, JSON documents, HTML attributes, and HTTP headers.

Every three bytes of input become four characters of output, so Base64 text is about 33% larger than the original data. When the input length is not a multiple of three, = padding characters fill out the final group.

Base64 is an encoding, not encryption. Anyone can decode it, so it offers no protection for passwords or other secrets.

Standard and URL-safe alphabets

Alphabet Characters 62 and 63 Padding Typical use
Standard (RFC 4648 §4) + and / = Email (MIME), data URLs
URL-safe (RFC 4648 §5) - and _ Usually omitted JWTs, URL parameters, filenames

The standard characters + and / have special meanings in URLs, which is why the URL-safe variant replaces them.

Unicode text

Browsers’ built-in btoa function only accepts characters in the Latin-1 range, so encoding text such as “naïve”, “日本語”, or emoji directly would fail. This tool first converts text to UTF-8 bytes and then encodes those bytes, which matches the behaviour of most programming languages and command-line tools:

printf '%s' 'héllo' | base64
# aMOpbGxv

When decoding, the tool checks that the result is valid UTF-8 text. If it is not, the Base64 probably represents binary data such as an image or a compressed file, which cannot be displayed as text.

All conversion runs locally in your browser; nothing is uploaded.

More tools

  • Developer

    JSON Formatter and Validator

    Format, minify, validate, and sort JSON in your browser, with error messages that point to the exact line and column of a syntax problem.

    Open tool

  • Developer

    Unix Timestamp Converter

    Convert Unix timestamps in seconds or milliseconds to readable UTC and local dates, and convert dates back to timestamps, with live current time.

    Open tool

  • Machine learning

    Classification Metrics Calculator

    Calculate accuracy, precision, recall, F1, specificity, balanced accuracy, and Matthews correlation coefficient from a binary confusion matrix.

    Open tool