Decode Base64 to text, preview images, detect file types and download the original file — with precise errors.
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
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
Percent-encode a query value, a whole URL or form data, line by line if you like, with double-encoding warnings.
Decode a JSON Web Token, check its claims and expiry, flag risks, and verify HS, RS, PS, ES or EdDSA signatures.
Generate random v4 or time-ordered v7 UUIDs in bulk, in the format you need.
Related guides
JSON, Base64, URL encoding and HTML entities explained
What JSON, Base64, percent-encoding, HTML entities, UUIDs and Unix timestamps are for — and the common mistakes developers make with each.
CSS colour formats explained: HEX, RGB, HSL, HWB and OKLCH
What each CSS colour format means, when to use it, why OKLCH is useful for palettes, and how to check colour contrast for accessibility.
JWTs explained: structure, claims, decoding vs verifying, and common mistakes
How JSON Web Tokens work, what each part and claim means, why decoding isn't verifying, and the mistakes that cause real security bugs.