Skip to main content

Base64 Encoding & Decoding Online

Encode text to Base64 or decode a Base64 string back to readable text.

Built and tested by Muhammad Irfan Liaqat · Updated

Base64 Encode/Decode: key facts

  • Encodes text to Base64 and decodes Base64 back to text as you type
  • Handles UTF-8, so accented letters, non-Latin scripts and emoji round-trip correctly
  • Uses the standard Base64 alphabet with + and /; URL-safe Base64 must be converted first
  • Text only: to encode an image or other file, use Image to Base64

What Base64 encoding does

Base64 turns data into text made of 64 safe characters: A–Z, a–z, 0–9, + and /, with = used as padding at the end. This tool encodes any text, including accented letters, emoji and non-Latin scripts, to Base64 using UTF-8, and decodes Base64 back to readable text.

Base64 is used wherever only plain text can travel: HTTP Basic authentication headers, data URIs, email attachments and binary values stored in JSON. It makes data about 33% larger, because every 3 bytes become 4 characters. It is an encoding, not encryption: anyone can decode it, so never rely on it to hide passwords or keys. To convert an image, use the Image to Base64 tool.

How to encode or decode Base64

  1. 1Paste or type text, or a Base64 string, into the input box
  2. 2Click Encode to convert text to Base64, or Decode to convert Base64 to text
  3. 3Check the result in the output box
  4. 4Click Copy to copy it

Frequently Asked Questions

What is Base64 encoding?
Base64 is a way of representing any data using 64 printable characters (A–Z, a–z, 0–9, + and /). It lets binary data or special characters pass safely through systems designed for plain text.
What does Base64-encoded text look like?
A string of letters, digits, + and /, often ending in one or two = signs. The word Hello encodes to SGVsbG8=, and decoding SGVsbG8= gives Hello back. Base64 (sometimes shortened to b64) has no other markers, so a string in that format is only a guess until it decodes cleanly.
Is Base64 encryption?
No. Base64 can be decoded by anyone without a key. Use it to transport data, never to protect it.
Is Base64 a hash?
No. A hash such as SHA-256 is one-way and always the same length, while Base64 is fully reversible and grows with the input. To fingerprint text, use the Hash Generator instead.
Why does Base64 make data larger?
Every 3 bytes of input become 4 characters of output, so encoded data is about 33% larger than the original.
What do the = signs at the end mean?
They are padding. When the input length is not a multiple of 3 bytes, one or two = signs are added so the output length is a multiple of 4.
Why does decoding fail?
The input contains characters outside the Base64 alphabet, has been cut short, or uses the URL-safe variant, which has - and _ in place of + and /. Replace - with + and _ with /, then try again.
Does it decode URL-safe Base64?
Not as is. URL-safe Base64, used in JWTs and some URLs, replaces + with - and / with _. Change them back, and add = padding if the length is not a multiple of 4, then decode.
How do I Base64-encode text in JavaScript or Python?
In JavaScript, btoa("hello") gives aGVsbG8=, but btoa only accepts Latin-1 text, so encode UTF-8 first for other characters. In Python, base64.b64encode("hello".encode()).decode() gives the same result.
Can I decode Base64 to an image or file?
Not with this tool, which decodes to text. A Base64 image that starts with data:image/ can be pasted into a browser's address bar to view it and save it.

Related Tools

Guides