webtrajans
en

Base64 Encode & Decode

Encode text or files to Base64 and decode Base64 back to text or a downloadable file — UTF-8 safe, with a URL-safe option.

File to Base64

This tool runs entirely in your browser; your data is never sent to a server.

How to use

  1. 1Type or paste text to encode, or paste Base64 to decode.
  2. 2Toggle URL-safe mode if the result goes into a URL, filename or JWT.
  3. 3To encode a file, drop it in to get Base64 or a data URI (images get a preview).
  4. 4To restore a file from Base64, decode and download it.

What Base64 is (and isn’t)

Base64 represents binary data with 64 printable ASCII characters (A–Z, a–z, 0–9, + and /), so it can travel through text-only channels like JSON, email (MIME), HTML and HTTP headers. Every 3 bytes become 4 characters, making output about 33% larger, with = padding at the end. It is an encoding, not encryption: anyone can decode it, so never use it to “hide” passwords or API keys.

UTF-8 and URL-safe Base64

The browser’s built-in btoa() fails on characters outside Latin-1 such as emoji, ü or Cyrillic; this tool encodes text as UTF-8 first, so any language works. URL-safe Base64 (RFC 4648 §5) replaces + with - and / with _, and usually drops the = padding, so the value can sit in URLs, filenames and JWT tokens without extra escaping.

When to use data URIs

A data URI (data:image/png;base64,…) embeds a file directly in HTML or CSS, saving an HTTP request. It is worth it for tiny assets — small icons or SVGs under a few KB. For larger images it backfires: the file grows by a third, can’t be cached separately and bloats your HTML or CSS.

Frequently asked questions

Is Base64 secure?

No. It is reversible by anyone with no key. Use real encryption for sensitive data.

Why does decoding give garbled text?

The input may be binary data (an image or file) rather than text, may be URL-safe Base64 without the URL-safe toggle on, or may have been encoded in a different character set.

How do I convert an image to Base64?

Drop the image into the file area. You get the raw Base64 string and a ready-to-use data URI with a preview.

Are my files uploaded?

No. Encoding and decoding run entirely in your browser.

Not happy with the results?

Talk to Webin Agency about fast, SEO-friendly websites, e-commerce and Google Ads management.

Get free advice

Related tools