Skip to content
PocketDesk
Your files are processed on your device, never uploaded

Base64 encode and decode

  • On device
Input
Ln 1, Col 11 line0 BUTF-8

Paste, drop or open a file in Input to see the result here.

Waiting for input
  • ⌘Enter Run now
  • ⌘⇧C Copy result
  • ⌘F Find in result
  • Esc Exit full screen
  • Use Ctrl instead of ⌘ on Windows and Linux

How to encode or decode Base64

  1. Choose a direction: Encode text to Base64 or Decode Base64 to text.
  2. Paste your text into the box. The result appears as you type.
  3. For encoding, turn on URL-safe alphabet if the result goes in a URL, and turn off Keep = padding to remove the trailing equals signs.
  4. Select Copy to put the result on your clipboard.

Decoding accepts both the standard and the URL-safe alphabet, ignores spaces and line breaks, and works with or without padding. A leading data:...;base64, prefix is removed for you.

What Base64 is

Base64 writes any bytes using only 64 safe characters: letters, digits, plus and slash. It is used where binary data must travel through systems built for text, such as email, JSON, HTML, CSS and HTTP headers. The output is about one third larger than the input.

This tool works on text only. It first turns your text into UTF-8 bytes, so characters beyond plain English survive the round trip. Decoding binary data, such as a PNG, is not shown as text: the tool tells you the bytes are not valid text. To turn a picture into Base64, use image to Base64.

Tips

  • If decoding fails, look for a stray character, a missing piece at the end, or a URL-safe string with characters that were changed in transit.
  • Basic HTTP authentication sends username:password as Base64. It is encoded, not protected, so only use it over HTTPS.
  • Inspect a login token with the JWT decoder, which reads the Base64URL parts for you.
  • Percent-encoding for query strings is a different thing: use URL encode and decode.

Privacy

Encoded strings are often keys, tokens or credentials. Nothing you paste here is uploaded, stored or logged. The work is done by your browser on your device.

Questions

Is Base64 encryption?

No. Base64 only changes how data is written, and anyone can decode it. Never use it to hide passwords or secrets.

Does it work with emoji and non-English text?

Yes. Text is converted as UTF-8 first, so Hindi, Arabic, Chinese and emoji encode and decode correctly.

What is URL-safe Base64?

It swaps the + and / characters for - and _ so the text can sit in a URL or file name. JWTs use this form.

Can I encode a file or image?

This tool handles text only. For pictures, use the image to Base64 tool, which creates a data URI.

Is my text sent anywhere?

No. Encoding and decoding happen in your browser, so your data never leaves your device.

More developer tools