How to use the Base64 tool
Text
- Choose Encode or Decode.
- Type or paste your text. The result updates as you type.
- When encoding, tick URL-safe output if the result will go into a URL or a file name.
- Press Copy, or Use result as input to reverse the operation and check the round trip.
When decoding, standard and URL-safe Base64 are both recognized automatically, with or without the = padding. Spaces and line breaks are ignored, and a leading data URL prefix such as data:text/plain;base64, is removed for you.
Files
Choose a file of up to 10 MB and pick the output: plain Base64, URL-safe Base64 or a complete data URL that you can paste into HTML or CSS.
Your text and files stay on your device
Encoding and decoding happen in your browser. Files are read locally and are never uploaded to our server.
How Base64 works
Base64 turns any bytes into 64 safe characters: A–Z, a–z, 0–9, + and /. Every 3 bytes (24 bits) are split into four 6-bit groups, and each group becomes one character. If the input does not divide evenly by 3, the output is padded with one or two = signs.
Text is first converted to bytes with UTF-8, so accented letters, other alphabets and emoji all work correctly.
Worked example
The word Café is 5 bytes in UTF-8, because é takes two bytes (C3 A9). Five bytes need two groups of three, so the output is 8 characters with one padding sign: Q2Fmw6k=.
The text Hi?> encodes to SGk/Pg==. The URL-safe version replaces / with _ and + with -, and drops the padding: SGk_Pg.
Good to know
- Base64 is an encoding, not encryption. Anyone can decode it, so never use it to hide passwords or secrets.
- The output is about 33% larger than the input: 4 characters for every 3 bytes.
- If valid Base64 decodes to bytes that are not UTF-8 text, the tool tells you instead of showing garbled characters. Such data is usually a binary file like an image.
- Data URLs are convenient for small icons, but large files are better served as normal files.