How to encode or decode Base64 here
- Paste your text or Base64 string into the Text tab. To convert a whole file, switch to the File tab and choose a file of up to 10 MB.
- Set the Direction to Auto, Encode or Decode. The section below explains when Auto guesses wrong.
- Choose the Variant. Standard Base64 uses
+,/and=padding. Base64URL uses-and_and has no padding. - The result updates as you type. If you change the direction or variant, the tool converts the input again straight away.
- Click Copy result to copy the output. After a decode in the File tab, "Download decoded file" saves the raw bytes as
decoded-file.bin.
The Input bytes and Output bytes counters count UTF-8 bytes, not characters. For example, zażółć is 6 characters but 10 bytes, because each Polish letter takes two bytes.
Base64 encode and decode examples
| Input | Direction / Variant | Output |
|---|---|---|
Hello World! |
Auto, Standard | SGVsbG8gV29ybGQh |
zażółć |
Encode, Standard | emHFvMOzxYLEhw== |
zażółć |
Encode, Base64URL | emHFvMOzxYLEhw |
<<??>> |
Encode, Standard | PDw/Pz4+ |
<<??>> |
Encode, Base64URL | PDw_Pz4- |
user:pass |
Encode, Standard | dXNlcjpwYXNz |
The two <<??>> rows show how the variants differ. The same bytes give / and + in standard Base64 but _ and - in Base64URL. That lets a Base64URL string go into a URL or file name without percent-encoding.
You don't have to clean up Base64 before you decode it. Spaces and line breaks are ignored, so you can paste wrapped output from MIME email attachments, PEM blocks or terminal logs as it is:
SGVs bG8g
V29y bGQh → Hello World!
Missing = padding is also accepted. SGVsbG8 decodes to Hello, the same as SGVsbG8=.
When auto-detection picks the wrong direction
Auto decodes the input only when it is valid Base64 for the selected variant and the decoded bytes are valid UTF-8 text. Everything else is encoded. This can surprise you in a few ways:
- Short words:
TWFuis valid Base64 forMan, andZm9vdecodes tofoo, so Auto decodes both. Words liketestorabcddon't decode to valid text, so they get encoded (dGVzdA==,YWJjZA==). To encodeTWFuitself, choose Encode and you getVFdGdQ==. - Wrong variant: with Standard Base64 selected, Auto treats
PDw_Pz4-as plain text and encodes it toUER3X1B6NC0=, because-and_aren't in the standard alphabet. Switch to Base64URL and the same input decodes to<<??>>. - Damaged input: Auto encodes a malformed string instead of reporting a problem. For example,
SGVsbG9=becomesU0dWc2JHOT0=.
If you know the input is Base64, select Decode. The tool then shows "Enter valid Base64 for the selected variant." instead of guessing. That covers a mismatched alphabet and strings a correct encoder could never produce, such as SGVsbG9=, whose last character carries leftover bits. You can use this to spot a truncated or hand-edited value.
Text, binary files and the 10 MB limit
Text input is encoded as UTF-8, so accented letters, emoji and non-Latin scripts come back unchanged after decoding. With Decode selected, if the decoded bytes aren't valid UTF-8 (an image, a ZIP or a compressed payload), the text view shows an error instead of garbled characters. In Auto, the same input counts as text and is encoded. A PNG header such as iVBORw0KGgo= turns into aVZCT1J3MEtHZ289.
To recover binary data, save the Base64 string to a .txt file. Upload it in the File tab with Decode selected, then use "Download decoded file".
In the File tab with Encode selected, any file up to 10 MB becomes a single Base64 string with no line breaks. Larger files are rejected before they are read. Everything runs locally in the browser, so pasted tokens and config secrets are not sent anywhere. Base64 is an encoding, not encryption: anyone can decode it.
Related next steps
- A JWT is made of Base64URL segments, and its signature isn't text. The JWT Decoder splits a token into its header and payload and shows them as formatted JSON.
- To make text safe for a query string, use the URL Encoder / Decoder. Percent-encoding is a different scheme from Base64URL.
- To embed a picture in CSS or HTML, Image to Base64 produces a ready
data:URI with the correct MIME type.
Both alphabets and the padding rules are defined in RFC 4648.