130 of 149 tools live Roadmap LatestImage to Text

Base64 Encoder and Decoder

Base64 both ways: text or a file in, text, a data URI or a file out, with nothing sent anywhere.

Works in your browser. Text and files never leave your device.

Direction

Base64

Everything happens in your browser. Text and files never leave your device.

Base64 Encoder and Decoder at a glance

Price
Free
Data sent to us
None, it runs in your browser
Sign-up
Not needed
Encodes
Text or any file
Decodes to
Text, or a file of the detected type
Options
URL-safe, line breaks, data URI

How to use Base64 Encoder and Decoder

Takes about 1 minute. You need text, a file, or some Base64.

  1. Choose the directionEncode turns text or a file into Base64; Decode turns Base64 or a data URI back.
  2. Put in the inputType or paste into the left box, or choose or drop a file. The result appears on the right as you type.
  3. Copy or downloadPress Copy for the text, or Download to save it as a file. A decoded image or document downloads with the right extension.
Base64 Encoder and Decoder: Base64 both ways: text or a file in, text, a data URI or a file out, with nothing sent anywhere.

Type or paste text, or drop a file, and read its Base64 as you type, with the URL-safe alphabet, 76-character lines or a data URI as options; an image comes back as a data URI, an HTML img tag or a CSS background line, ready to paste. Paste Base64 or a data URI to decode it: text is shown as text, and anything else is recognised by its first bytes, previewed if it is an image, and offered as a download with the right extension. Spaces, line breaks, missing padding and both alphabets are handled on the way in.

How it works

Base64 Encoder and Decoder is a web page that does its work on your own device. The file you choose is opened by your browser, changed there and saved from there; it is never sent to a server, so there is no copy of it anywhere to delete, no queue and no waiting for an upload. Most online tools of this kind send your file to their servers and work on it there, and many keep it for a while. This one does not. There is no account, no watermark and no limit on how often you use it, and the result downloads the moment it is ready.

Straight to one job

What Base64 is

Base64 writes any sequence of bytes using 64 printable characters: the letters, the digits, plus and slash, with equals signs as padding at the end. Every three bytes become four characters, so the result is a third larger than the original. It exists so that binary data, such as an image or a PDF, can travel through places that only accept text: email bodies, JSON, HTML and CSS, web addresses and configuration files. It is an encoding, not encryption: anyone can decode it, and it hides nothing.

The two alphabets

Standard Base64 uses plus and slash, which have meanings inside a web address, so a second alphabet, the URL-safe one, swaps them for hyphen and underscore and usually drops the padding. Tokens, signed links and some APIs use it. The decoder here accepts either, with or without padding, and ignores spaces and line breaks, so a value copied from an email or a log decodes as it is. The 76-character line option matches the way email attachments are encoded.

Data URIs

A data URI puts a whole file inside a web page or stylesheet: data:image/png;base64, followed by the Base64. It saves a request for a small icon or a font and lets a single HTML file carry its pictures. Encoding a file here produces the URI with the right type, or a ready <img> tag or CSS background-image line. Decoding a data URI gives the file back, with its type read from the prefix or, failing that, from the first bytes of the data.

What comes back from decoding

Decoded bytes are shown as text when they are valid UTF-8 without control characters, which covers JSON, HTML, certificates and ordinary text. Otherwise the first bytes are checked against the signatures of common file types, PNG, JPEG, GIF, WebP, PDF, ZIP, MP3, WAV, MP4 and web fonts, and the result is offered as a download with the right extension, with a preview for images. Nothing is sent anywhere: the encoding and decoding run in your browser.

What it does

  • Encode text (as UTF-8) or any file up to 50 MB
  • Decode to text, or to a file with the type sniffed from its bytes
  • Standard or URL-safe alphabet, optional 76-character lines
  • Data URIs in and out, with img tag and CSS forms for images
  • Image preview for decoded pictures, including SVG
  • Tolerant decoding: whitespace, missing padding, either alphabet
  • No upload, no account, no sign-up

Questions

Is my text or file uploaded?

No. Encoding and decoding run in your browser on your own device. Nothing is sent to us or to anyone else, and nothing is stored.

How do I Base64 encode a string?

Choose Encode, type or paste the text, and the Base64 appears on the right. Text is encoded as UTF-8, so accented letters and emoji round-trip correctly. Press Copy to take it.

How do I decode Base64 to text?

Choose Decode and paste the Base64. If the bytes are text, they are shown; if they are a file, such as an image or a PDF, it is recognised and offered as a download, with a preview for images.

What is URL-safe Base64?

The same encoding with a hyphen for plus and an underscore for slash, and usually no padding, so it can sit in a web address or a token without being changed. Tick URL-safe alphabet to produce it; the decoder accepts both forms automatically.

How do I convert an image to Base64 for HTML or CSS?

Choose Encode, drop the image, and leave Data URI ticked. Pick An HTML img tag or CSS background-image under Give me to get a line you can paste straight into a page or a stylesheet. Keep it for small images; a large one makes the page heavier than a normal file would.

Why is Base64 bigger than the original?

Every three bytes become four characters, so the result is a third larger, and more with line breaks. It is a cost of fitting binary data into text.

Is Base64 encryption?

No. It only changes how bytes are written, and anyone can decode it instantly. Do not use it to hide passwords or personal data.

Is it free?

Yes, completely free, with no sign-up and no size limit beyond what your browser can hold.

More

Privacy policy · Support · Changelog

Suggest a tool

Tell us what the tool should do. If we build it, we will let you know.

Used only to reply to you. See our Privacy Policy.