Skip to content
JustTools

Base64 Encoder & Decoder

Convert text to Base64 and back as you type, turn images and files into Base64 or data URLs, and decode any Base64 — with the file type recognised and a download button.

Runs in your browser Free · no sign-up

At a glance

  • Encodes and decodes Base64 (RFC 4648) as you type, with text treated as UTF-8 — Hindi, ₹ and emoji round-trip correctly.
  • Supports Base64URL (- and _, as in JWTs), with or without = padding, and 76-character line wrapping for email (MIME).
  • The decoder ignores spaces and line breaks, accepts missing padding and data: URLs, and says exactly which character is invalid.
  • Decoded binary data is recognised — PNG, JPEG, WebP, GIF, PDF, ZIP, MP3, MP4, fonts and more — with an image preview and a download button.
  • Converts any file to Base64 or a data URL, and gives ready-made <img> and CSS snippets for images.
  • Runs entirely in your browser: nothing you encode or decode is uploaded.

Step by step

How to encode or decode Base64

  1. 1

    Choose text or file

    Use Text to convert text, or File / image to convert a file.

  2. 2

    Pick Encode or Decode

    Encode turns text into Base64; Decode turns Base64 back.

  3. 3

    Paste or drop

    Paste text or Base64, or drop a file. The result appears immediately.

  4. 4

    Copy or download

    Copy the result, or download the decoded file with the right extension.

Features

Everything you need, nothing you don’t

Live both ways

Switch between Encode and Decode and the result carries over — handy for checking a round trip.

Base64 to image or PDF

Paste Base64 from an API or email source and get the actual file back, previewed and ready to save.

Image to data URL

Drop an icon or logo to embed it directly in HTML, CSS or JSON.

Clear errors

Invalid characters, misplaced padding and truncated input are explained instead of failing silently.

JWT friendly

Decode the parts of a JSON Web Token — they’re Base64URL without padding.

Private

Tokens, keys and files stay on your device.

Base64 in a nutshell

Base64 writes any data — text, images, PDFs — using just 64 safe characters (A–Z, a–z, 0–9, + and /), so it can travel through systems made for text: JSON, XML, email, URLs and HTML. Every 3 bytes become 4 characters, so Base64 is about 33% larger than the original.

Base64 is not encryption. Anyone can decode it instantly, so never use it to hide passwords or secrets. To protect data, encrypt it; to shorten it, compress it.

Standard vs URL-safe Base64

Standard Base64Base64URL
Characters 62 and 63+ and /- and _
Padding= at the endUsually left out
Used inEmail attachments, data URLs, most APIsURLs, file names, JWTs, WebAuthn
ExamplePz4/Pg==Pz4_Pg

FAQ

Frequently asked questions

How do I convert Base64 to an image?

Choose Text → Decode and paste the Base64 (with or without the data:image/…;base64, prefix). The tool recognises the image, shows a preview and lets you download it with the right extension.

How do I convert an image to Base64?

Choose File / image and drop the image. You get a data URL ready for an <img> tag or CSS, or plain Base64 if you switch to “Base64 only”.

Why does my decoded text look garbled?

The Base64 probably holds binary data (an image, a PDF, compressed data) rather than text — the tool then shows the file type instead. If it’s text in an old encoding other than UTF-8, some characters may not show correctly.

Is Base64 secure?

No. It’s an encoding, not encryption: anyone can decode it. Use it to transport data, not to protect it.

What is the = at the end?

Padding, which makes the length a multiple of 4. Base64URL often leaves it out; this decoder works either way.

Is my data uploaded?

No. Encoding and decoding happen entirely in your browser, including for files.

Keep going

Browse every tool

Last updated Report a problem or suggest a feature