Encoding

Base64 Encoder & Decoder

Encode text to Base64 or decode Base64 back to readable text. Unicode is handled as UTF-8, and URL-safe Base64 is supported.

Guide: Base64 Is Not Encryption: How It Works and Why

Ready.

What it does

Base64 turns bytes into plain ASCII text so binary data can travel through systems that only handle text, such as JSON, email headers and URLs. This tool encodes your text as UTF-8 first, so accented letters, emoji and other scripts round-trip correctly.

How to use

  1. Choose Encode or Decode.
  2. Type or paste into the input box; the result updates as you type.
  3. Tick URL-safe to use - and _ instead of + and / and to drop the = padding.

Good to know

Base64 is an encoding, not encryption: anyone can decode it. When decoding, the tool accepts URL-safe input, ignores whitespace and adds missing padding for you.

Example

Hello, 世界 encodes to SGVsbG8sIOS4lueVjA==. With URL-safe ticked the same text gives SGVsbG8sIOS4lueVjA, and a value such as ???>>> becomes Pz8_Pj4- instead of Pz8/Pj4+. URL-safe Base64 is what JSON Web Tokens use for each segment; you can read one with the JWT Decoder.

Common problems

  • "Not valid Base64": the input contains characters outside A-Z a-z 0-9 + / - _ =, for example a stray quote, a data URL prefix such as data:image/png;base64,, or a length that cannot be Base64.
  • "Not valid UTF-8 text": the Base64 is well formed but decodes to binary bytes, such as an image or a compressed file. This tool shows text only, so use Image to Base64 to turn an image file into a Base64 data URL.
  • Padding and line breaks: missing = signs and line breaks, as in MIME-wrapped Base64, are accepted when decoding.

Frequently asked questions

Why is Base64 larger than the original?

Base64 writes every 3 bytes as 4 characters, so the data grows by about a third. In return it uses only plain, safe text characters.

What is the difference between Base64 and URL-safe Base64?

URL-safe Base64 uses - and _ instead of + and /, and drops the = padding, so the result can sit in a URL or a filename. JSON Web Tokens use this variant.

How do I decode a data URL?

Remove the prefix, such as data:image/png;base64, and decode only the part after the comma. To create one from an image file, use Image to Base64.

Is Base64 encryption?

No. Anyone can decode it, so never use it to protect a password or a secret.

Is my text uploaded?

No. Encoding and decoding run in your browser.

Privacy

This tool runs entirely in your browser. What you enter is processed on your device and is not sent to a server.

Share this tool

Your data is not included in this link.