Skip to content
ToolHive

Base64 Encoder

Encode text to Base64 and decode it back, with correct UTF-8 handling so accents, CJK and emoji round-trip exactly. Supports the URL-safe variant, multi-line input, and one-click swapping between directions.

Converter Tools

How to use Base64 Encoder

  1. Choose a direction: text to Base64, or Base64 back to text.
  2. Paste your input. The result appears as you type.
  3. Tick URL-safe when the value has to travel in a URL or a JWT.
  4. Press Swap to move the result into the input and flip direction — handy for verifying a round trip.
  5. Copy the output, or download it as a text file.

Examples

Plain ASCII

The classic example.

Hello, World!  ->  SGVsbG8sIFdvcmxkIQ==

Unicode that breaks naive tools

btoa() throws on these. Encoding the string to UTF-8 bytes first is what makes them work.

café       ->  Y2Fmw6k=
日本語      ->  5pel5pys6Kqe
🐦 nest    ->  8J+QpiBuZXN0

URL-safe output

Used by JWTs and anything that appears in a query string or path segment.

standard:  a+b/c==
url-safe:  a-b_c

Features

  • Correct UTF-8 handling: emoji, CJK and combining marks survive the round trip
  • URL-safe variant (RFC 4648 §5) with - and _ instead of + and /, and no padding
  • Decoding accepts both the standard and URL-safe alphabets automatically
  • Multi-line text, tabs and line endings are preserved exactly
  • Clear errors for invalid characters, wrong length, or bytes that are not text
  • Shows the size difference, which is roughly a third larger after encoding
  • Swap button turns the output into the next input
  • Everything runs locally — tokens and payloads are never uploaded

Frequently asked questions

Why do other Base64 tools break on emoji?
Because they call btoa() directly, which only accepts code points 0-255 and throws on anything else. This tool encodes the text to UTF-8 bytes first and encodes those, which is the only approach that handles the full Unicode range.
What is the difference between Base64 and Base64url?
Base64url replaces + with - and / with _, and usually drops the = padding, so the value is safe in a URL path, query string or filename. JWTs use it. Decoding here accepts either form.
Is Base64 encryption?
No. It is an encoding, not a cipher — anyone can decode it, as this page demonstrates. Never use it to protect a secret.
Why is my encoded string bigger than the original?
Base64 represents three bytes as four ASCII characters, so output is about 33% larger, plus padding. That is the cost of making binary data safe for text-only channels.
Can I decode a Base64 image or file?
You can paste it, but if the bytes are not valid UTF-8 text the tool will say so rather than show mojibake. This tool is for text; a data URL belongs in an image viewer.
Does whitespace in the input matter?
No. Line breaks and spaces are stripped before decoding, so Base64 that was wrapped at 76 characters — as email encoding does — decodes fine.

Related tools

About Base64 Encoder

Base64 Encoder is part of Converter Tools on ToolHive, a growing collection of small, focused utilities for developers, designers and students. Convert between encodings, cases and data formats in a single click. Everything runs client-side, so your data never leaves the browser tab — which makes these tools safe to use with work-in-progress code and private content.