Developer utility

Base64 Encoder & Decoder

Convert text to Base64 format or decode Base64 strings safely in your browser.

Base64 Encoder & Decoder

Convert text and files to and from Base64, with full Unicode support.

Processed on your device
0 characters
0 characters

About the Base64 Encoder & Decoder

Base64 is a way of writing any data, including text, images and files, using only 64 safe, printable characters. It is used wherever binary data has to travel through a system built for text: email attachments, JSON APIs, data URIs, tokens and certificates.

This tool encodes and decodes text and files entirely in your browser. Text is handled as UTF-8, so Urdu, Arabic, accented letters and emoji work correctly. It also supports the URL-safe variant, optional padding and MIME line wrapping, and it is forgiving when decoding: stray spaces, line breaks, missing padding and data URI prefixes are handled for you.

How to Use

  1. 1Choose the Text tab for strings or the File tab for images, PDFs and other files.
  2. 2Pick a direction: Encode to turn plain data into Base64, or Decode to turn Base64 back into the original.
  3. 3Paste your input. The result updates instantly, with an exact error message if the input is not valid.
  4. 4Copy the result, download it as a .txt file, or for decoded files, download the original file.

Key Features

  • Correct UTF-8 handling for any language and emoji
  • Standard and URL-safe (base64url) output, with or without padding
  • Optional 76-character line wrapping for MIME and PEM-style output
  • Forgiving decoder with precise, specific error messages
  • File to Base64 and data URI, and Base64 back to a downloadable file
  • Automatic file type detection and image preview
  • Free, private, with no sign-up and no uploads

What Is Base64 and How Does It Work?

Computers store everything as bytes, and a byte can hold 256 different values, many of which are control codes that break text-only systems. Base64 solves this by regrouping the bits. It takes 3 bytes (24 bits) and splits them into 4 groups of 6 bits. Each 6-bit group is a number from 0 to 63, which is then looked up in a 64-character alphabet.

Worked example: "Man"

Text:   M        a        n
Bytes:  77      97      110
Bits:    01001101 01100001 01101110
Groups: 010011 010110 000101 101110
Values:19      22      5       46
Base64: T        W        F        u

"Ma" becomes TWE= (one padding character) and "M" becomes TQ== (two), because the last group is incomplete.

The 64-character alphabet

UppercaseA-Zvalues 0 to 25
Lowercasea-zvalues 26 to 51
Digits0-9values 52 to 61
Symbols+ /values 62 and 63 (URL-safe: - and _)
Padding=fills the last group; not a data value

About 33% larger

3 bytes in, 4 characters out. A 3 MB file becomes about 4 MB of text, plus a little more if line breaks are added.

Padding with =

Output length must be a multiple of 4. One missing byte in the last group adds one =, two missing bytes add two.

Lossless and reversible

Decoding returns exactly the original bytes. Nothing is compressed, rounded or lost.

Base64 Is Not Encryption

This is the most common and most costly misunderstanding about Base64. Encoding changes the format of data so it can be transported. Encryption uses a secret key so that only authorised people can read it. Base64 has no key, no secret and no algorithm to break: the process is public and anyone can reverse it in a second, exactly as you can with the Decode button above.

 Base64 (encoding)Encryption (e.g. AES)
PurposeCarry binary data as textKeep data secret
Needs a keyNoYes
Anyone can reverse itYes, instantlyNo, not without the key
Safe for passwords and tokensNoYes, when used correctly
Changes data sizeAbout +33%Depends on the algorithm

If you find credentials or API keys stored as Base64 in a config file or repository, treat them as if they were stored in plain text.

Common Uses of Base64

Data URIs in HTML and CSS

Small images and icons can be embedded directly in markup as data:image/png;base64,... to save an HTTP request. It is practical for tiny assets but bad for large images, which are 33% bigger and cannot be cached separately.

Email attachments (MIME)

Email was designed for text, so attachments are Base64-encoded and wrapped at 76 characters per line. This is where the line-wrapping convention comes from.

JSON Web Tokens (JWT)

A JWT is three Base64URL strings joined by dots: header, payload and signature. The first two are just encoded JSON, so anyone can read them. That is why you should never put secrets in a token's payload.

HTTP Basic authentication

The Authorization header carries username:password as Base64. This is not protection, so it must only be used over HTTPS.

Binary data inside JSON or XML

JSON has no binary type, so APIs commonly send files, keys and hashes as Base64 strings inside a JSON field.

Certificates and keys (PEM)

PEM files for certificates and keys are Base64 text between BEGIN and END lines, wrapped at 64 or 76 characters per line.

Common Mistakes to Avoid

Treating it as security

Base64 hides nothing. An encoded password is a plain-text password to anyone who sees it.

Ignoring the character set

Encoding text without saying how it becomes bytes causes garbled characters when another system decodes it. Use UTF-8 on both ends.

Mixing standard and URL-safe forms

A + or / inside a URL gets mangled, and a - or _ fed to a strict standard decoder is rejected. Use the form the receiving system expects.

Double encoding

Encoding already-encoded text gives output that looks valid but decodes to more Base64. If a decoded result is itself Base64, decode again.

Stray whitespace and missing padding

Copying from emails or terminals often adds line breaks or removes trailing = signs. This decoder tolerates both, but many strict libraries do not.

Embedding large files as Base64

A 2 MB image becomes about 2.7 MB of text, loaded with the page and never cached on its own. Reserve data URIs for small assets.

Frequently Asked Questions

Is Base64 a form of encryption?+

No. Base64 is an encoding, not encryption. Anyone can reverse it instantly without a key, exactly as this tool does. It exists to represent binary data using only printable characters, not to keep anything secret. Never use Base64 to hide passwords, tokens or personal data. Use real encryption for that.

Is my data uploaded anywhere?+

No. Text is encoded and decoded by JavaScript running in your browser, and files are read with the browser's FileReader API. Nothing you enter is sent to ProTools Hub or any other server, and nothing is stored after you close the page.

Why does my Base64 end with one or two equals signs?+

Base64 works in groups of three bytes. When the data does not divide evenly, the last group is padded with = characters so the output length is a multiple of four: one = when one byte is missing from the group, two when two are missing. Some systems, such as JWTs, leave the padding off, which you can do here with the Remove padding option. The decoder accepts both forms.

What is URL-safe Base64?+

Standard Base64 uses + and /, which have special meaning in URLs and file names. The URL-safe variant (base64url, defined in RFC 4648) replaces them with - and _ and usually drops the padding. It is used in JSON Web Tokens and many web APIs. Turn on the URL-safe option when encoding, and the decoder detects either form automatically.

Why is the Base64 output larger than the original?+

Every 3 bytes of input become 4 characters of output, so Base64 is about 33% larger than the original data. Adding line breaks every 76 characters (the MIME style) increases it slightly more. That overhead is the price of being able to carry binary data through text-only channels. If you only need to compress or store data, Base64 is the wrong tool.

Does it work with Urdu, Arabic, emoji and accented text?+

Yes. Text is first converted to bytes using UTF-8, then encoded, and decoding reverses both steps. This is why the result can differ from tools that use another character set such as Latin-1: Base64 encodes bytes, so the same text can give different Base64 depending on how it was turned into bytes. UTF-8 is the standard on the web and is what most systems expect.

Why does decoding say the data is not valid UTF-8?+

The Base64 itself was valid, but the bytes inside are not readable UTF-8 text. That usually means the data is a binary file such as an image, PDF or ZIP, or text saved in a different character set. Use the Show binary info button to see its size and detected type, or switch to the File tab to download the decoded file.

What are the size limits?+

Text mode accepts up to 5 million characters. The File tab converts files up to 10 MB and decodes Base64 up to about 14 million characters. Everything happens in your browser's memory, so very large inputs depend on your device. For multi-gigabyte data, use a command-line tool such as base64.

Related Free Tools