Base64 Encode and Decode: Free and Private

Use this base64 encode & decode tool to turn text or files into Base64 and back. Paste text or drop a file to encode it, or paste Base64 to decode it. Choose URL-safe output if you need it. It runs in your browser, so nothing is uploaded.

Base64 Encoder & Decoder

Convert text and files to and from Base64.

or drop a file here
Base64 is an encoding, not encryption: anyone can decode it, so never use it to hide passwords. Encoded data is about 33% larger than the original. Files up to 50 MB are supported.
Everything runs in your browser. Text and files are not uploaded.

How to use the Base64 encoder and decoder

  1. To encode text, paste it in the top box and press Encode.
  2. To decode, paste the Base64 (or a data: URI) and press Decode for text, or Decode to file to download images, PDFs and other binary data.
  3. To encode a file, click Encode a file. Tick Files as data URI to get a string you can paste into HTML or CSS.
  4. Copy the result with Copy result.

How it works

Text is first turned into UTF-8 bytes, so accents, Arabic, Chinese and emoji work correctly, and then every 3 bytes become 4 characters from the 64-character Base64 alphabet. URL-safe mode uses - and _ instead of + and / and drops the = padding. Decoding reverses the process, accepts both alphabets and missing padding, and detects common file types (PNG, JPG, GIF, PDF, ZIP, MP3, WAV, WebP) from their first bytes.

Example

The text "Hello, world!" encodes to SGVsbG8sIHdvcmxkIQ== and decodes back exactly. A 30 KB PNG logo encodes to a data URI of about 40,000 characters that you can paste into an img tag.

Frequently asked questions

Is Base64 encryption?

No. It only changes how data is written so it can travel through text-only systems like email or JSON. Anyone can decode it.

Why does my decoded text look garbled?

The data may be a file (such as an image) rather than text. Use Decode to file. It may also have been encoded with a different character set than UTF-8.

What is URL-safe Base64?

A variant that uses - and _ instead of + and / so the result can be used in URLs and file names. It is used in JWT tokens, for example.

Are my files uploaded?

No. Encoding and decoding happen in your browser.

See also: Hex Calculator, Binary Calculator.

Encode or decode Base64

How to use it

  1. Paste text or drop a file.
  2. Pick encode or decode.
  3. Choose URL-safe if needed.
  4. Copy or download.

More questions

Is Base64 encryption?

No. Anyone can decode it, so don't use it to hide secrets.

Why is the output longer?

Base64 makes data about a third bigger, so the output is longer.

Can I turn an image into a data URI?

Yes. Use the image to Base64 converter to make a data URI.

Related tools: Image to Base64 Converter, URL Encode and Decode, JWT Decoder.

Four steps to Base64 encode or decode: paste text or pick a file, choose URL-safe or line wrap, encode or decode, copy
How to encode and decode Base64.
Base64 examples: Hello, World! becomes SGVsbG8sIFdvcmxkIQ==, cafรฉ becomes Y2Fmw6k= and URL-safe output uses - and _
Worked examples from the tool code.