Base64 Encoder

Encode text or a file as Base64 — standard, URL-safe or as a data URI — right in your browser. Nothing you enter or choose is uploaded.

Encoded locally in your browser — text and files are never uploaded

Encoded as UTF-8, so accents and emoji work. Ctrl/⌘ + Enter copies the result.
Options
Decode Base64 →

How it works

Text is first converted to UTF-8 bytes. Every 3 bytes (24 bits) are then split into four 6-bit groups, and each group becomes one of 64 characters: A–Z a–z 0–9 + /. If the last group is short, = padding makes the length a multiple of 4.

  • URL-safe replaces + and / with - and _ and drops the padding, as JWTs do.
  • Files are read as raw bytes, so images, PDFs and anything else encode exactly. With “data URI” on, the result starts with data:<type>;base64, and can be used directly in HTML or CSS.
  • MIME wrapping breaks the output into 76-character lines for email.

Example

Hello → SGVsbG8= (5 bytes become 8 characters, with one = of padding).

Hello, Mzansi! 👋 → SGVsbG8sIE16YW5zaSEg8J+Riw==. The emoji is 4 bytes in UTF-8. URL-safe: SGVsbG8sIE16YW5zaSEg8J-Riw.

A small PNG icon becomes something like data:image/png;base64,iVBORw0KGgo…, which you can paste into <img src="…"> or a CSS url(…).

Frequently asked questions

Is Base64 encryption?

No. Base64 is an encoding, not encryption — anyone can decode it instantly. Use it to carry binary data as text (in JSON, HTML, CSS or email), never to hide secrets.

Is my text or file uploaded?

No. Encoding happens in your browser with built-in JavaScript functions. Files are read from your device into memory and never uploaded to ToolTarvern.

When should I use URL-safe Base64?

When the result goes into a URL, a filename or a JWT. URL-safe Base64 (RFC 4648 §5) uses - and _ instead of + and /, and usually drops the = padding.

What does “wrap at 76 characters” do?

It inserts a line break every 76 characters, as required by MIME email (RFC 2045). Leave it off for JSON, data URIs and most APIs.

Why is the result bigger than the original?

Every 3 bytes become 4 characters, so Base64 is about 33% larger (plus line breaks if you wrap). That’s why large images are usually better as separate files than as data URIs.

Related tools

Decode Base64 to text, preview images, detect file types and download the original file — with precise errors.

FreeRuns in your browser

Percent-encode a query value, a whole URL or form data, line by line if you like, with double-encoding warnings.

FreeRuns in your browser

Decode a JSON Web Token, check its claims and expiry, flag risks, and verify HS, RS, PS, ES or EdDSA signatures.

FreeRuns in your browser

Generate random v4 or time-ordered v7 UUIDs in bulk, in the format you need.

FreeRuns in your browser

Related guides