Base64 Encoder / Decoder
Encode text or files to Base64 and decode Base64 back to text. Handles UTF-8, URL-safe Base64 and padding, and shows how every byte becomes a character.
How to Use
- Choose Encode (text or file → Base64) or Decode (Base64 → text).
- Type or paste into the input box, or drop a file to encode it. The result updates as you type.
- Tick URL-safe for tokens and URLs, No padding to drop trailing
=, or Wrap at 76 for email (MIME). - Read the byte breakdown and the Show Work section to see exactly how the characters were made.
- Press Copy for the result, or Swap to send it back through the other way.
Worked Example
Encode the word “Man”.
Bytes: M = 77, a = 97, n = 110 (hex 4D 61 6E).
Bits: 01001101 01100001 01101110.
Regroup into 6 bits: 010011 010110 000101 101110 = 19, 22, 5, 46.
Look each up in the alphabet (A = 0 … Z = 25, a = 26 … z = 51, 0 = 52 … 9 = 61, + = 62, / = 63): 19 = T, 22 = W, 5 = F, 46 = u.
Result: TWFu — 3 bytes became 4 characters.
Encode “Ma” (2 bytes, 16 bits). Add two zero bits to make 18: 010011 010110 000100 = 19, 22, 4 = T, W, E. One byte is missing from the group of three, so one = is added: TWE=. A single byte, “M”, gives TQ==.
Show Work
Formulas
Where Base64 Came From
Early email could only carry plain 7-bit text, and some mail systems changed or dropped anything else. To send binary data safely, Privacy-Enhanced Mail (PEM, RFC 1421, 1993) used a 64-character alphabet chosen from characters that survive every system: letters, digits, + and /.
MIME (RFC 2045, 1996) adopted the same scheme for email attachments, with lines of at most 76 characters. RFC 4648 (2006) defined Base64 on its own, together with the URL-safe “base64url” variant that swaps + and / for − and _. Today it is everywhere text has to carry bytes: data URIs, JSON APIs, certificates (the familiar -----BEGIN CERTIFICATE----- blocks) and web tokens.
About This Tool
This tool encodes text and files to Base64 and decodes Base64 back to text. Text is converted to UTF-8 first, so accented letters, other alphabets and emoji round-trip correctly — “café” is 5 bytes, not 4.
Decoding accepts standard and URL-safe input, with or without padding or line breaks. If the decoded bytes are not text, it says so and offers them as a file instead of showing garbage. Everything runs in your browser; files and text are never uploaded.
The byte breakdown and Show Work make it a teaching tool as well: you can see each byte split into bits and regrouped into the characters of the result.
Related tools: URL Encoder / Decoder, HTML Entity Encoder, and Unicode Lab.
Frequently Asked Questions
What is Base64?
Base64 turns any bytes into text made only of A–Z, a–z, 0–9, + and /. It takes 3 bytes (24 bits) at a time and writes them as 4 characters of 6 bits each, so binary data can travel through systems that only handle plain text, such as email, JSON and URLs.
Why does Base64 make data about 33% bigger?
Every 3 bytes become 4 characters, so the output is 4/3 of the input plus padding. A 1 MB file becomes about 1.33 MB of Base64 text, and about 1.37 MB if it is wrapped into 76-character email lines (each line also ends in a 2-byte line break).
What do the = signs at the end mean?
They are padding. When the input is not a multiple of 3 bytes, the last group is filled out: “Man” (3 bytes) is TWFu, “Ma” is TWE= and “M” is TQ==. Some formats, such as JSON Web Tokens, leave the padding off.
What is URL-safe Base64?
The same encoding with “-” and “_” in place of “+” and “/”, which have special meanings in URLs and file names (RFC 4648, section 5). It is used in JSON Web Tokens, URL parameters and file names, usually without padding.
Is Base64 encryption?
No. Anyone can decode it instantly — there is no key. It only changes how bytes are written down. Never use Base64 to hide passwords or secrets; HTTP Basic Auth sends “user:pass” as dXNlcjpwYXNz, which is why it must only be used over HTTPS.
How do I use the Base64 Encoder / Decoder?
Just type or paste your value. The answer shows up right away — there is no button to press. Change anything and it updates by itself.
Is it free? Does it work without internet?
Yes to both. It is free with no sign-up, and once the page has loaded it keeps working even with no internet.
Where does my data go?
Nowhere — every calculation runs on your own device. Nothing you enter is uploaded, logged, or stored.
Common Use Cases
Data URIs
Embed a small image straight into CSS or HTML: a 2 KB PNG becomes about 2.7 KB of text after data:image/png;base64,.
HTTP Basic Auth
The Authorization header is “Basic ” plus Base64 of user:password — user:pass becomes dXNlcjpwYXNz. Decode one to check what a client is sending.
JSON Web Tokens
A JWT is three URL-safe, unpadded Base64 parts joined by dots. Decode the first two to read the header and claims (the signature stays binary).
Email attachments
MIME email carries attachments as Base64 in lines of at most 76 characters. Tick Wrap at 76 to produce the same layout.
Binary in JSON or XML
JSON has no binary type, so APIs send files, keys and thumbnails as Base64 strings and decode them on the other side.
Last updated: