Base64 encode and decode

Base64 represents binary data using 64 printable characters. It is an encoding, not encryption: anyone can decode it.

Features

  • UTF-8 safeAccents and emoji survive the round trip.
  • URL-safe modeFor tokens and filenames.
  • Runs on your deviceYour data is processed in the browser and is never uploaded.

How to use the Base64 converter

  1. Choose Encode or Decode.
  2. Paste your text.
  3. Tick URL-safe if the result goes in a URL or filename.
  4. Copy the result.

Standard and URL-safe Base64

RFC 4648 defines both. The URL-safe form replaces + with - and / with _, and padding is often left off.

Base64 for UTF-8 text in JavaScript

const encoded = btoa(String.fromCharCode(...new TextEncoder().encode(text)));
const decoded = new TextDecoder().decode(Uint8Array.from(atob(encoded), (c) => c.charCodeAt(0)));

Frequently asked questions

Is Base64 secure?

No. It hides nothing from anyone who decodes it.

Why is the output longer?

Every 3 bytes become 4 characters, about 33% larger.

Can I decode files or images?

This tool handles UTF-8 text only.

Related tools