Base64 Encoder / Decoder: convert text to Base64 and back
Encode plain text into Base64 or decode Base64 back to text. Supports UTF-8 characters, URL-safe encoding, and MIME line-wrapping. Everything runs in your browser.
How to use the Base64 Encoder
-
1
Choose mode Select whether you want to Encode or Decode using the tabs at the top of the tool.
-
2
Paste your text Paste your text or Base64 string into the input box. You can also load a .txt, .json, or .csv file directly.
-
3
Configure options Enable URL-safe encoding or MIME line-wrapping if you need them for specific developer use cases.
-
4
Copy the result The conversion happens instantly. Copy the result to your clipboard or download it as a file.
Special features
Frequently asked questions
What is Base64 encoding?
Base64 is a binary-to-text encoding scheme. It converts binary data (like images, documents, or special text characters) into a string of ASCII characters (A-Z, a-z, 0-9, +, /). This is commonly used when transmitting data over media that only supports text, such as embedding images in HTML/CSS or sending attachments in emails.
What does 'UTF-8 safe' mean in this tool?
Many basic Base64 tools use the built-in btoa() function, which crashes if you try to encode emojis, Chinese characters, or accented letters. Our tool uses a specialized two-step process (TextEncoder) to convert Unicode text into bytes before encoding. This ensures that any character from any language, including emojis like 😀, encodes and decodes perfectly without throwing errors.
What is URL-safe Base64?
Standard Base64 uses the '+' and '/' characters, which have special meanings in URLs (they can be misinterpreted as spaces or path separators). When the 'URL-safe' option is checked, we automatically replace '+' with '-' and '/' with '_', and remove the trailing padding '=' signs. This makes the string safe to use in web links, filenames, or JSON Web Tokens (JWT).
Why would I need MIME line-wrapping?
The MIME standard (used in email attachments) dictates that Base64 strings must be broken into lines no longer than 76 characters. This prevents older email servers from dropping the message or misinterpreting the data. If you are generating Base64 for an email body or an API that requires strict MIME formatting, enable the 'Line wrap' option.
How do I use the 'Load File' feature?
If you need to encode the contents of a text file (like a JSON file, CSV, or TXT document), you can click the 'Load file' button next to the input box. The tool will read the text file from your device and paste its contents directly into the input box. No file is ever uploaded to a server; it is read locally by your browser.
Is my data safe?
Yes. Your text is processed entirely in your browser. It is never uploaded, stored, or sent anywhere. The tool does not use cookies, analytics, or localStorage.
Does the tool work offline?
Yes. Because the tool is built entirely with vanilla JavaScript, it works completely offline after the page loads.