Free online tools by Soft Tech Mark. No sign-up needed. seo4tricks@gmail.com · WhatsApp +92 312 7666075

Base64 Encoder and Decoder

Convert text, files and images to Base64 and back. Works with UTF-8, URL-safe Base64 and data URIs, all inside your browser.

This tool runs 100% in your browser. Your files and text are never uploaded to any server.

Want better rankings and more leads?Our team can fix the issues this tool finds and grow your traffic. The first consultation is free.

What is Base64?

Base64 is a way to write any data, including images and files, using only 64 safe characters: A-Z, a-z, 0-9, + and /. It is used when binary data has to travel through systems that only handle text, such as email attachments, JSON APIs, HTML and CSS. The format is defined in the internet standard RFC 4648.

Base64 is encoding, not encryption. Anyone can decode it, so never use it to hide passwords or secrets.

What this tool can do

Text tab

  • Encode any text to Base64, with full UTF-8 support for Urdu, Arabic, emojis and accented letters
  • Decode Base64 back to readable text
  • URL-safe option that uses - and _ instead of + and / and removes padding, as used in JWT tokens and URLs

File / Image tab

  • Turn any file (up to 20 MB) into Base64 and a ready data URI like data:image/png;base64,...
  • See a preview of images
  • Paste Base64 or a data URI and download it as a file

How to encode or decode Base64

  1. For text, type or paste into the input and click Encode or Decode.
  2. For files, switch to the File / Image tab and choose a file.
  3. Copy the result with one click.

Common uses

  • Embedding small images in HTML or CSS as data URIs, saving an extra request
  • Sending files through JSON APIs
  • Reading email source code, where attachments are Base64 encoded
  • Debugging tokens such as the parts of a JWT

Size tip: Base64 makes data about 33% larger. Embedding large images as data URIs slows pages down, so only do it for tiny icons. For normal images, compress them with the Image Compressor and link to the file instead.

Learn more about Base64 in browsers from MDN's Base64 glossary. Need to tidy JSON that contains Base64 values? Use the JSON Formatter. See all text and developer tools.

Base64 in everyday web work

You will often meet Base64 when working on websites. Favicons and small icons are sometimes embedded as data URIs, which you can create here after making the icon with our Favicon Generator. Email signatures and HTML newsletters may embed logos the same way. API responses that contain Base64 values are easier to read after tidying them with the JSON Formatter. Remember that data URIs make pages heavier, so check the result with the Page Size Checker.

How Base64 works

Base64 turns any data, text or binary, into a string made of just 64 safe characters: A-Z, a-z, 0-9, + and /, with = used as padding at the end. It takes every 3 bytes of input and turns them into 4 characters. That is why Base64 output is always about 33 percent larger than the original. The format is defined in the standard RFC 4648.

Example: the word Hi becomes SGk=. The = shows that the last group had fewer than three bytes.

Base64 vs. Base64URL

Standard Base64 uses + and /, which have special meanings in URLs. Base64URL replaces them with - and _ and often drops the = padding. You will see Base64URL in JSON Web Tokens (JWTs) and some API keys. If decoding a token fails, try replacing - with + and _ with / first.

Common real-world uses

  • Data URIs: small images or icons embedded directly in HTML or CSS, like data:image/png;base64,..., saving one network request.
  • Email attachments: email protocols were built for text, so attachments are Base64-encoded behind the scenes (MIME).
  • APIs: sending images or files inside JSON, which only supports text.
  • Basic authentication headers: Authorization: Basic followed by Base64 of username:password.
  • JWT tokens: the header and payload parts are Base64URL-encoded JSON.

When not to use Base64 images

Embedding images as Base64 can make pages slower for anything but tiny icons. The text is a third larger than the image file, it cannot be cached separately by the browser, and it blocks the HTML or CSS from loading quickly. As a rule, only inline images under a few kilobytes. For normal images, compress them with the Image Compressor and link to the file instead.

Base64 is not encryption

Anyone can decode Base64 in a second, so never use it to hide passwords or secrets. It is a way to package data, not to protect it. To create real secrets, use the Password Generator, and store sensitive data with proper encryption. If you work with JSON that contains Base64 strings, the JSON Formatter helps you read it. More background is in the MDN glossary entry on Base64.

Example: embedding a small icon in CSS

Suppose you have a tiny 1 KB arrow icon used on every page. Instead of an extra network request, you can embed it:

  1. Choose File / Image and select the icon.
  2. Click Encode to Base64. The tool shows a full data URI starting with data:image/png;base64,.
  3. Copy it into your CSS: background-image: url("data:image/png;base64,....");
  4. Test the page in your browser to check the icon appears.

Use this only for very small images. For a normal photo, the Base64 text would be much larger than the original file and would slow the page down. The opposite also works: if you find a long Base64 string in an email source or API response, paste it here, decode it and download it as a file to see what it contains.

Frequently Asked Questions

Is Base64 secure?

No. It is just a different way of writing data and can be decoded by anyone. Use real encryption for secrets.

Why does decoding show an error?

The input may contain invalid characters, or the decoded data may be a file rather than text. Use the File tab to download it.

Are my files uploaded?

No. Encoding and decoding happen in your browser.

What is a data URI?

A data URI puts a whole file inside a link, starting with data: and the file type, so it can be used directly in HTML or CSS.

Does Base64 support Urdu and emoji?

Yes. Text is converted to UTF-8 bytes first, so any language and emoji encode and decode correctly.

Why is my Base64 string so long?

Base64 is always about a third larger than the original data, plus any data URI prefix.

Can I turn a Base64 string back into an image file?

Yes. Paste the string, decode it and use Download as file to save the image.

Tags: Base64 encoding decoding data URI developer tools images to Base64

Last updated: October 25, 2026