Skip to content

Base64 decode and encode: text, images and files

Decode Base64 to read it as text, preview it as an image or save it as a file, and encode text or any file to Base64. Text is converted to UTF-8 first, so Arabic, Urdu and emoji come back exactly as written. Images and files are read only in your browser.

Quick answer

To decode Base64, choose Decode and paste the string: text appears at once, an image shows a preview you can download, and any other file downloads with the right extension. To encode, choose Encode text and type, or choose File to Base64 and pick an image to get Base64 or a data URL.

Based on RFC 4648, The Base16, Base32, and Base64 Data Encodings (IETF) · Page updated 18 October 2026

Text is encoded as UTF-8, so Arabic and emoji decode correctly anywhere.

Encoded and decoded on your device. Nothing is uploaded or saved.

How to use the Base64 Encoder / Decoder

  1. Pick a mode: Encode text, Decode Base64, or File to Base64.
  2. Type or paste your text or Base64, or choose a file. The result appears straight away; for a file, choose whether you want plain Base64, a data URL, an HTML img tag or a CSS line.
  3. Copy the result, or download it: decoded images and files are saved with the right extension, and Base64 output as a .txt file.

How Base64 works

Base64 writes any data using 64 safe characters: A to Z, a to z, 0 to 9, plus and slash. RFC 4648, the IETF standard, takes the input three bytes at a time (24 bits) and writes them as four characters of six bits each. When the input does not divide by three, one or two equals signs pad the end. That is why Base64 is about a third larger than the original: a 30 KB image becomes about 40 KB of text. It is an encoding for carrying data through systems built for text, such as e-mail, JSON and HTML, not a way to hide it.

Arabic and other scripts in Base64

Base64 works on bytes, not letters, so text must first be turned into bytes. This tool always uses UTF-8, the encoding the web and JSON use, which is why "مرحبا" becomes 2YXYsdit2KjYpw== and decodes back to the same word. Many quick converters use the browser's btoa function directly, which fails or garbles anything outside Latin-1; here Arabic, Persian, Urdu, Hindi and emoji are handled the same as English. If decoding gives bytes that are not valid UTF-8 text, the tool treats them as a file instead of showing broken characters.

Image to Base64 and Base64 to image

Choose File to Base64 and pick a PNG, JPG, WebP, SVG or GIF to get a data URL such as data:image/png;base64,iVBOR…, which you can paste into an HTML img tag, a CSS background or a JSON field. The same output menu gives plain Base64, a full img tag or a CSS line. To go the other way, paste a data URL or bare Base64 into Decode: the tool reads the first bytes of the result to recognise PNG, JPEG, GIF, WebP, BMP, ICO, AVIF, SVG and PDF files, shows images as a preview and saves the file with the matching extension. Small icons and logos suit data URLs; for large photos a normal image file loads faster, because the encoded text is larger and cannot be cached on its own.

URL-safe Base64, padding and line breaks

RFC 4648 also defines base64url, which uses minus and underscore instead of plus and slash so the result is safe in web addresses and file names; it is used in JSON Web Tokens. Tick URL-safe to produce it, and No padding to drop the equals signs as JWTs do. Older e-mail (MIME) wraps Base64 at 76 characters per line; tick the 76-character option to match. When decoding, the tool accepts all of these forms, ignores spaces and line breaks, and adds missing padding itself.

Base64 is not encryption

Anyone can decode Base64 in a second, so never use it to protect passwords or personal data. A password stored as Base64 is as good as plain text. To protect a file use real encryption, such as a password-protected PDF, and to make a strong password use a generator.

Frequently asked questions

How do I decode Base64 to an image?

Choose Decode Base64 and paste the string or the whole data URL. If it is an image you see a preview straight away, and the download button saves it as PNG, JPG or whatever the image really is.

Why does my Arabic text look broken after decoding elsewhere?

The other tool probably decoded the bytes as Latin-1 instead of UTF-8. This tool encodes and decodes text as UTF-8, so Arabic, Urdu and emoji come back exactly as written.

What does the error about an invalid character mean?

Base64 may only contain letters, digits, plus, slash (or minus and underscore) and equals signs at the end. The message shows the first other character and its position, often a stray quote or comma copied with the string.

Is my file uploaded when I convert it to Base64?

No. The file is read by your browser and converted on your device. Nothing is sent to a server, and the result disappears when you close the page.

How much bigger does a file get in Base64?

About a third bigger: every 3 bytes become 4 characters, plus up to two padding signs. A 300 KB photo becomes roughly 400 KB of Base64 text.