Skip to main content
Screendesk
Free tool

Base64 Decode and Encode

Decode Base64 to text or images and encode text or files to Base64, with UTF-8, URL-safe base64url, and data URLs. Everything runs in your browser.

Open source on GitHub

Text or file to encode

Base64 output

Your base64 output appears here as you type.

Runs entirely in your browser. Nothing you paste here is uploaded or stored.

How it works

How Base64 encoding works. Three bytes in, four characters out.

Base64 encoding steps
StepWhat happens
1. BytesText is first turned into bytes. This tool uses UTF-8, so “é” becomes 2 bytes and most emoji become 4.
2. Groups of 3The bytes are split into groups of 3 (24 bits).
3. Four 6-bit valuesEach 24-bit group is read as four 6-bit numbers from 0 to 63.
4. AlphabetEach number maps to one of 64 characters: A–Z, a–z, 0–9, then + and / (or - and _ in base64url).
5. PaddingIf the last group has 1 or 2 bytes, the output ends with “==” or “=” so its length is a multiple of 4.
Reference

Base64 variants. Which alphabet and padding each format uses.

Base64 variants compared
VariantAlphabetPaddingUsed in
Standard (RFC 4648 §4)A–Z a–z 0–9 + /Required (=)MIME email, PEM certificates, most APIs
URL-safe base64url (RFC 4648 §5)A–Z a–z 0–9 - _Usually omittedJWTs, URLs, filenames, WebAuthn
Data URLStandard alphabet after data:<type>;base64,RequiredInline images and fonts in HTML and CSS
MIME (RFC 2045)Standard alphabet, lines wrapped at 76 charactersRequiredEmail attachments
FAQ

Frequently asked questions

What is Base64 encoding?

Base64 is a way to represent binary data as plain text using 64 safe characters. Every 3 bytes become 4 characters, so the output is about 33% larger than the input. It is used wherever binary data must travel through text-only channels: email attachments, JSON payloads, data URLs, HTTP Basic auth headers, and JWTs.

Is Base64 encryption?

No. Base64 is an encoding, not encryption. Anyone can decode it without a key, so never use it to hide passwords, API keys, or personal data. Use real encryption (for example AES-GCM) or hashing where secrecy matters.

Why does my decoded Base64 show strange characters?

Either the data is binary (an image, PDF, or compressed file) rather than text, or it was encoded with a different character set. This tool decodes as UTF-8 and switches to a hex view with a download button when the bytes are not valid text. Images are detected from their file signature and previewed.

What is the difference between Base64 and base64url?

base64url replaces + with - and / with _, and usually drops the = padding, so the result can be used in URLs and filenames without escaping. JWTs use base64url. This decoder accepts both alphabets, with or without padding.

How do I convert an image to Base64?

Choose “File to base64” and pick the image. The tool reads it in your browser and outputs a data URL such as data:image/png;base64,iVBOR…, which you can paste into an <img src> attribute or a CSS url(). Turn off the data URL prefix to get only the raw Base64. Files never leave your device.

Customer support runs on Screendesk.

Start for free