UtilityNest

Base64 Encoder and Decoder

Convert text to Base64 and back as you type, turn an image or any file into a Base64 data URI, or paste Base64 to get the original file back with its type detected.

How to use Base64 Encoder and Decoder

  1. 1Text tab: choose Encode or Decode and paste your text. Turn on URL-safe for tokens and URLs. The result updates instantly.
  2. 2File to Base64 tab: drop an image or any file to get a data URI, plain Base64, and for images a ready-made HTML img tag and CSS background rule.
  3. 3Base64 to file tab: paste Base64 or a data URI. The file type is detected, images are previewed, and you can download the file.
  4. 4Use Copy next to any result, or Swap to reverse a text conversion.

Text with any language or emoji

Many simple Base64 tools fail on accented letters, Chinese text or emoji because the browser's built-in function only handles Latin characters. This tool encodes text as UTF-8 first, matching what servers, APIs and command-line tools expect. The decoder accepts standard and URL-safe Base64, missing padding, line breaks and data: prefixes.

If the Base64 you paste is actually a file such as an image or PDF, the Text tab tells you and points you to the file tab instead of showing garbled characters.

Images to Base64 data URIs

Embedding a small icon or logo as a data URI saves an extra request, which is useful for emails, single-file HTML pages and CSS. Base64 makes files about 33 percent larger, so it is best for images of a few KB. For larger images, a normal image file loads faster.

Base64 back to a file

Paste the Base64 from an API response, a JSON field or an email source to recover the file. The type is detected from the file's own signature (PNG, JPG, GIF, WebP, PDF, ZIP, MP3, SVG, text and more) so it downloads with the right extension. Everything runs in your browser; nothing is uploaded.

Exactly how much bigger Base64 makes data

Base64 turns every 3 bytes into 4 characters and pads the last group with = signs. Results from the Text tab:

InputUTF-8 bytesBase64
a1YQ== (4 characters)
Hello5SGVsbG8= (8)
안녕하세요157JWI64WV7ZWY7IS47JqU (20)

The formula is 4 x (bytes / 3, rounded up), so a 3 MB image becomes 4 MB of text. That overhead is why email attachments take more room than the file on disk: Microsoft's Exchange documentation notes that Base64 encoding increases message size by about 33% and that the usable size is smaller than the configured limit (checked October 2026). Gmail allows 25 MB of attachments and turns anything larger into a Google Drive link.

Reading a JWT or an encoded email subject

JWT tokens are three URL-safe Base64 parts separated by dots: header, payload and signature. Paste only the middle part into Decode. In our test, a payload without padding decoded straight to {"sub":"1234567890","name":"김민지","iat":1516239022}, Korean name included. Decoding shows what a token claims; it does not prove the signature is valid.

Email source works much the same way. A subject line like =?UTF-8?B?7ZqM7J2YIOyekOujjCDshqHrtoA=?= is Base64 between ?B? and ?=, and pasting 7ZqM7J2YIOyekOujjCDshqHrtoA= decoded to the Korean subject 회의 자료 송부. Attachments in the raw message are Base64 split into lines; the decoder ignores the line breaks, so you can paste the whole block into the Base64 to file tab.

Standard and URL-safe alphabets

RFC 4648 defines both alphabets. Standard Base64 uses + and / and pads with =; the URL-safe variant uses - and _ and usually drops the padding, so the text can sit in a URL or a file name without further encoding. Mixing them up is a common reason a token fails to verify: a + in a URL query is often read as a space. Turn on URL-safe when encoding for JWTs, URL parameters and file names, and leave it off for email, data URIs and most APIs that document plain Base64.

Frequently asked questions

How do I convert an image to Base64?

Open the File to Base64 tab and drop the image. Copy the data URI, the HTML img tag or the CSS rule.

How do I convert Base64 back to an image?

Paste the Base64 or data URI into the Base64 to file tab. The image is previewed and you can download it.

Is Base64 encryption?

No. Base64 is an encoding that anyone can reverse. Do not use it to protect passwords or private data.

What is URL-safe Base64?

A variant that uses - and _ instead of + and / and drops the = padding, so it can be used in URLs and file names. JWT tokens use it.

Why is my decoded text garbled?

The data is probably a file rather than text, or text in a different encoding. Try the Base64 to file tab to detect its type.

Why does my Base64 end with = or ==?

Base64 works in groups of 3 bytes. When the input length is not a multiple of 3, the last group is padded: one = for 2 leftover bytes, two == for 1. YQ== is the single letter a. URL-safe Base64 drops the padding, and this decoder accepts both.

How much bigger is a file after Base64 encoding?

About 33 percent: 4 characters for every 3 bytes. A 3 MB file becomes 4 MB of Base64 text, which is also why a 25 MB email limit fits noticeably less than 25 MB of attachments.

How do I read the contents of a JWT?

Copy the part between the two dots and paste it into Decode on the Text tab. URL-safe characters and missing padding are handled. The result shows the claims but does not verify the signature.

Related guides