Black Friday: 50% off every paid plan with code BF50. Ends 5 December.

See prices

Free tool

Base64 decode and encode, text and files.

Paste Base64 to read it, or type text to encode it, with any language and emoji kept intact. Base64 that holds a file is recognised from its first bytes, previewed, and downloaded with the right extension. Pick UTF-16 for PowerShell or Windows-1252 for older systems, do each line on its own, or switch to URL-safe Base64. Files and images go the other way too. Nothing leaves the browser, so keys and tokens stay private.

Need a custom tool, app or website? Contact us 
Base64
Text

Decoding accepts standard and URL-safe Base64, with or without = and line breaks, and data URLs.

Everything is converted in your browser. Nothing is uploaded or saved, so keys and tokens stay private. Only your settings are remembered on this device.

What Base64 is

Bytes as plain letters.

01 / Why

Safe in text

Base64 writes any data with 64 ordinary characters, so pictures and files can travel inside JSON, emails, HTML and CSS.

02 / Size

A third bigger

Every 3 bytes become 4 characters, so Base64 is about 33% larger than the original.

03 / Not secret

Encoding, not encryption

Anyone can decode Base64. Never use it to hide a password.

Guide

How to decode Base64, and what it is really doing.

Base64 decode turns a string of letters, numbers, + and / back into the text or file it was made from. Base64 is a way of writing any data with only 64 safe characters, so it can travel inside emails, JSON, web addresses and code. This tool decodes and encodes it in your browser: text comes back as UTF-8 with accents and emoji intact, and Base64 that holds a picture, PDF or other file is recognised, previewed and ready to download.

How to decode Base64

  1. Paste the Base64 into the left box. Decode is already selected. Line breaks, spaces and a leading data:...;base64, are ignored, and URL-safe Base64 works too.
  2. Read the decoded text on the right, or press Copy the result.
  3. If the Base64 holds a file, the page names the type and size, shows a preview for pictures, PDFs, audio and video, and offers Download with the right extension. Open First bytes, in hex to see the start of the file.
  4. Have the Base64 in a file? Press Open file or drop the .txt on the box, and it is read and decoded.

If you paste plain words while Decode is selected, or Base64 while Encode is selected, a link above the box offers to switch. Swap flips the direction and moves the result into the input, so you can check a round trip.

How to encode text or a file

  1. Press Encode in the side panel and type or paste your text. The Base64 appears as you type.
  2. Tick URL-safe for tokens, links and file names, or Lines of 76 characters for email.
  3. For a file, open the File or image to Base64 tab and drop any file up to 50 MB. Copy the Base64, the data URL, or for a picture a ready HTML or CSS line.

Text encoding: UTF-8, UTF-16 and older sets

Base64 holds bytes, not letters, so the same text gives different Base64 in different character sets. UTF-8 is the default and fits almost everything today. The other choices under Text encoding are for the places that still use something else:

  • UTF-16 LE is what Windows PowerShell expects after -EncodedCommand. Encode a command with it and the result runs as written.
  • Windows-1252 and ISO-8859-1 are what older Western systems wrote. If decoded text shows odd marks where accents should be, try one of these.
  • Shift JIS, GBK and EUC-KR can be decoded but not encoded here, because the browser only reads them.

With the default setting, Base64 that is not valid UTF-8 is treated as a file. If it still looks like Western text, it is shown as Windows-1252, and the status line says so.

Each line on its own treats every line as a separate value, which helps with a list of encoded IDs or names. Empty lines stay empty.

How Base64 works: a worked example

Base64 takes the data 3 bytes at a time. Those 3 bytes are 24 bits, which it splits into four groups of 6 bits. Each 6 bit group is a number from 0 to 63, and each number maps to one character: A to Z are 0 to 25, a to z are 26 to 51, 0 to 9 are 52 to 61, then + is 62 and / is 63.

StepMan
Byte value7797110
Bits010011010110000101101110

Joined, those bits are 010011 010110 000101 101110. As numbers that is 19, 22, 5 and 46, which map to T, W, F and u. So "Man" encodes to TWFu. Decoding runs the same steps backwards.

When the data does not divide into groups of 3, the last group is padded with = signs. One byte left over gives two = signs, two bytes give one. That is why "Hi" encodes to SGk= and "Hello" to SGVsbG8=.

How much bigger Base64 makes things

Every 3 bytes become 4 characters, so Base64 is about a third larger than the original. A 30,000 byte picture becomes 40,000 characters. A 3 MB file becomes about 4 MB of text. Lines of 76 characters add a line break every 76 characters on top of that. This is why Base64 is handy for small icons and keys but a poor way to move large files.

OriginalBase64 length
3 bytes4 characters
1,000 bytes1,336 characters
30,000 bytes40,000 characters
3,000,000 bytes4,000,000 characters

Standard and URL-safe Base64

Standard Base64 uses + and /, which have special meanings in web addresses and file paths. URL-safe Base64, also called base64url, uses a hyphen and an underscore instead and usually leaves off the = padding. You will see it in JSON Web Tokens, in links and in some API keys. When you decode, you do not need to pick: this tool accepts both kinds, with or without padding. When you encode, tick URL-safe if the result is going into a link or a token.

When decoding fails

  • "Character 12 is ..., which Base64 never uses." Something other than letters, digits, the plus sign, slash, hyphen, underscore and = is in there, such as a quote mark, a full stop or a comma copied with it. The message gives its position. Remove it and anything else that is not part of the code.
  • "This Base64 is cut short." The length cannot be right, usually because only part of a long line was copied. Copy the whole value again, including any = at the end.
  • "There is an = sign in the middle." Two Base64 values were probably joined together. Split them, or tick Each line on its own if they are on separate lines.
  • It decodes to a file, not text. The bytes are not UTF-8 text, so the page looks at the first bytes to work out the type. It knows pictures (PNG, JPEG, GIF, WebP, AVIF, HEIC, BMP, ICO, TIFF, SVG), PDF, Word, Excel and PowerPoint files, EPUB, ZIP, gzip, 7-Zip and RAR archives, fonts (TTF, OTF, WOFF, WOFF2), audio (MP3, AAC, FLAC, Ogg, WAV, MIDI, M4A), video (MP4, MOV, WebM), and a few others like SQLite and WebAssembly. Anything else downloads as decoded.bin. If it should be text, pick its character set under Text encoding.
  • The text looks scrambled. It may be encrypted or compressed before it was encoded. Base64 only reverses the encoding, not encryption.

Base64 is not encryption

Anyone can decode Base64 in seconds, as this page shows. It hides nothing. If you find a password or key in Base64 in a config file, treat it as if it were written in plain text. That is also why it is safe to decode keys and tokens here: nothing is uploaded, and the work happens in this tab.

On a Mac

Terminal has a built-in base64 command. To decode some text, run echo 'SGk=' | base64 --decode, which prints Hi. To decode a file of Base64 into the original file, run base64 --decode -i input.txt -o output.png. To encode a file, run base64 -i photo.png. If the Base64 is on your clipboard, pbpaste | base64 --decode decodes it straight from there.

To read the header and payload of a token, use the JWT decoder. For pictures as data URLs with sizing tips, the image to Base64 tool goes further, and for percent signs in links, use URL encode and decode.

Questions

Good to know.

Why does my decoded text show odd characters on other sites?

Many simple decoders treat text as Latin letters only, which breaks accents, other alphabets and emoji. This page reads and writes UTF-8, so text comes back exactly as it went in.

What is URL-safe Base64?

A version that uses - and _ instead of + and /, and usually drops the = padding, so it can sit in a web address or a file name. JSON Web Tokens use it.

Should I put images in my CSS as Base64?

For small icons, it saves a request. For larger pictures it makes the page heavier, since Base64 is about a third bigger and cannot be cached on its own. A normal image file is usually better.

Is it safe to paste API keys or tokens here?

Yes. Everything happens in this tab, and nothing is sent anywhere or saved. Only your settings, such as the direction and character set, are remembered on this device.

How do I encode a PowerShell command in Base64?

Press Encode, set Text encoding to UTF-16 LE (PowerShell), and type the command. The result goes after powershell -EncodedCommand.

Can I decode several Base64 strings at once?

Yes. Put each on its own line and tick Each line on its own. Every line is decoded separately.

The decoder says my Base64 is cut short. Why?

A piece is missing, often from copying only part of a long line. Copy the whole value again, including any = at the end.

How do I know if a string is Base64?

It uses only letters, digits, + and / (or hyphens and underscores for URL-safe), often ends in one or two = signs, and its length is usually a multiple of 4. Paste it here: if it decodes to readable text or a known file type, it was Base64.

What does the = at the end of Base64 mean?

It is padding. Base64 works in groups of 3 bytes, and when the last group is short, one or two = signs fill it out. They carry no data, so URL-safe Base64 often leaves them off.

How do I turn Base64 into an image or a file?

Paste the Base64, with or without the data: prefix. The page recognises the type from the first bytes, shows a preview for pictures, PDFs, audio and video, and the Download button saves it with the right extension.

Can Base64 be decoded without a key?

Yes. Base64 has no key or password. It is a way of writing data, not a way of protecting it, so anyone with the string can decode it.

Listed on

Listed on JustMacAppsMotionShine on Mac App IndexMotionShine on ScrollLaunchMotionShine featured on StartupBaseFeatured on FazierFeatured on Twelve ToolsMotionShine - Featured on Smol Launch