Text and file encoding
Use the Base64 Encode / Decode to convert UTF-8 text or a local file to Base64, or decode Base64 into text or downloadable bytes.
How the calculation works
Base64 maps three bytes to four characters. Text uses UTF-8. The decoder accepts standard and URL-safe Base64, and file handling stays in the browser.
Decode and download
Recover readable text or save the original bytes.
Four Base64 characters usually represent three bytes, and padding can finish the final group. Use the text modes for UTF-8 strings and the file modes to preserve arbitrary bytes.
Worked example
Example inputs include Input Hello, world! 👋. The result is SGVsbG8sIHdvcmxkISDwn5GL.
How to read the result
Use the copy button for an encoded text result. In a file mode, use the download button to save the Base64 text or the decoded bytes.
Work with encoded text and binary files
Use the text modes for messages that should come back as readable UTF-8 text. Use the file modes when the content could include any byte value, such as an image or a document. Base64 converts bytes to a restricted text alphabet so they can travel through a text-only field. A file can generally be restored only when the entire encoded value is intact.
Check the round trip before sharing
Encode a short sample first when you are checking an integration. Decode the returned text and confirm it matches the original exactly, including Unicode characters. When working with files, save the output in the correct format and compare it with the original file type. Base64 changes the representation, and decoding recovers the original data when the input is complete.
Choose the mode for the data you have
Use text encoding for a short message and text decoding when the recovered bytes are UTF-8. If the original is an image, archive or another binary file, use the file workflow so the bytes can be downloaded without treating them as text.
To check a conversion, encode a short sample and then decode it in the matching mode. Compare the restored text or file with the original. Keep the complete encoded value when moving it between systems.
Common questions
No. Base64 represents bytes as text. Anyone who has the encoded text can decode it.
It uses four text characters for every three input bytes, with padding for a partial group.
Yes. Text is converted to UTF-8 bytes before encoding, so accented letters, emoji and other characters can round-trip.
They are padding used to complete the final Base64 group when fewer than three bytes remain.
The decoded bytes of a file may not form valid UTF-8. Decode to a file to retain the original binary data.