Base64 encoder and decoder

Encode text to Base64, decode Base64 back to text, or turn any file into a data URI. Everything runs in your browser.

Runs in your browser. Your file never leaves this device.

Loading the tool…

What this tool does

Base64 is a way of writing any data, text or a file, using only plain letters, numbers and a few symbols. Developers use it to put small images straight into HTML or CSS, to pass data through systems that only handle text, and to read values found in API responses and config files.

This tool has three modes. Text to Base64 encodes whatever you type, including Hindi or other scripts, using standard Base64. Base64 to text decodes a Base64 string back into readable text. File to Base64 reads any file and gives you a complete data URI, starting with data: and the file type, ready to paste into an img tag or a CSS background. Images get a preview.

Decoding only works when the result is text. It can't turn Base64 back into an image or other file yet. It also doesn't accept URL-safe Base64, the variant that uses - and _, or a string that still has its data: prefix.

Nothing you type or choose leaves your device, and once the page has loaded the tool needs no internet connection.

People use it for

  • Embedding a small icon in HTML or CSS as a data URI
  • Reading a Base64 value from an API response or a config file
  • Encoding a username and password pair for a Basic Auth header while testing
  • Checking what a Base64 string in an email header or log actually says

How to use it

  1. Pick a mode

    Choose Text to Base64, Base64 to text, or File to Base64.

  2. Paste text or choose a file

    Type or paste into the box, or drop a file in File mode. The result appears below with its length in characters.

  3. Copy or save the result

    Copy the output with one click. In decode mode you can also save the decoded text as a .txt file.

What it works with

You give itYou get
Text (any language)Base64
Base64Text
Any fileData URI (Base64)

Questions

Can I turn Base64 back into an image?

Not yet. Decoding here only produces text. Base64 that holds an image, a PDF or another file will show an error.

Is URL-safe Base64 supported?

No. This tool reads and writes standard Base64, which uses + and /. To decode the URL-safe kind, swap - for + and _ for / first.

Why does it say my Base64 isn't valid?

Common causes are a data: prefix at the start, URL-safe characters (- or _), a missing or extra character, or Base64 that holds a file rather than text.

Is Base64 a form of encryption?

No. Anyone can decode it, so never use it to hide passwords or private data. It only changes how data is written, not who can read it.

Why is the Base64 bigger than my file?

Base64 takes about a third more space than the original data. That's why it's best for small files, such as icons, rather than photos.

Is my data sent anywhere?

No. Encoding and decoding happen in your browser, and the tool works without an internet connection once the page is open.