Base64 decode online and encode text
Use this page to Base64 decode online or encode text. Both buttons use the same box and treat text as UTF-8. Encode is the primary button and writes standard Base64, including plus, slash, and equals-sign padding. Decode is the second button. Copy copies the output and shows Copied for two seconds.
The box starts as {"hello":"DangNH"}, which you can replace. Encode has no switch for a URL-safe alphabet. Decode does accept URL-safe text: a minus is read as a plus, an underscore is read as a slash, and missing padding is added so the length is a multiple of four. A space or a line break left in the middle is not removed, and decoding then fails.
1. Type or paste the text
Use the area labeled Input. This page has no Choose files button, so a PDF, an image, or any other binary file cannot be dropped here.
2. Click Encode
Encode turns the text into standard Base64. The word Hello becomes SGVsbG8=.
3. Click Decode
Paste Base64 into the same box and click Decode. SGVsbG8= becomes Hello. URL-safe text is accepted on Decode, including a string that left off the trailing equals signs, so SGVsbG8 becomes Hello as well.
4. Click Copy, then fix a failed decode
Copy copies the output and shows Copied for two seconds. Copy before Encode or Decode copies an empty string, not the placeholder word Output. A character that does not belong, or a line break in the middle, produces an output that starts with Invalid input:.
Examples
These pairs are the real UTF-8 results of Encode on this page, plus one URL-safe string that Decode accepts.
Hello
Click Encode on the word Hello. Click Decode on the result to get Hello back. Decode also accepts SGVsbG8 when the padding has been removed.
Hello SGVsbG8=
Hello, world!
The comma, the space, and the exclamation point are encoded with the rest of the sentence, and the output uses standard padding.
Hello, world! SGVsbG8sIHdvcmxkIQ==
A slash from Encode, an underscore for Decode
Encode writes subjects? as c3ViamVjdHM/ with a slash. Decode accepts that standard string, and it also accepts the URL-safe form c3ViamVjdHM_ because the underscore is read as a slash. Encode will not write the underscore form for you. The word café encodes as Y2Fmw6k= because the bytes are UTF-8.
subjects? c3ViamVjdHM/ café Y2Fmw6k=
Limitations
Base64 is not encryption
Anyone who can read the string can decode it. This page has no password, key, or secret, and encoding does not hide the text.
File-to-Base64 is not supported
There is no file picker and no drop target. You cannot turn a PDF or an image into Base64 here. A data URL prefix such as data:image/png;base64, is not removed for you. Only the text in the box is encoded or decoded.
Encode stays standard, and Decode is strict in the middle
URL-safe Base64 is accepted on Decode and is not produced by Encode. Encode does not wrap lines at 76 characters. Decode trims the ends of the input and still fails when spaces or line breaks remain in the middle. A long paste is handled in this browser and is not uploaded.