Base64 Decode & Encode

Base64 Decode & Encode

Paste Base64 to decode it, or switch to Encode to turn text or a file into Base64. Text is read as UTF-8, so accents, emoji and every script come out right; URL-safe Base64 and missing padding are handled, and a problem in the input is pointed out. Everything happens in your browser.

Direction
  • Decoded text

    Hello, world! 👋

Bytes18
AlphabetStandard (+ and /)
PaddingNot needed
Characters15

Calculated on your device · formulas checked against known results · How we test

How to decode or encode Base64

  1. To decode, paste the Base64 text into the box. The decoded text appears at once. Line breaks and spaces inside the Base64 are ignored, and a whole data URI (data:…;base64,…) works too.
  2. To encode, choose Encode and type or paste your text — or pick a file to get its Base64 and a ready-made data URI.
  3. Tick URL-safe Base64 when the result goes into a web address, a file name or a token. Decoding accepts both alphabets automatically.
  4. Press Copy beside the result. If the input isn’t valid Base64, the message says what is wrong and where.

How Base64 works

Base64 writes any data — text, images, files — using 64 characters that survive email, JSON, HTML and URLs unchanged: A–Z, a–z, 0–9, + and /. It takes the data three bytes (24 bits) at a time and cuts them into four groups of six bits; each group, a number from 0 to 63, picks one character. The standard is RFC 4648.

Man
Bytes7797110
Bits010011010110000101101110

Regrouped into six bits, those 24 bits are 010011 010110 000101 101110 — the numbers 19, 22, 5 and 46, which are the characters T, W, F and u. So “Man” becomes TWFu. When the data doesn’t fill a last group of three bytes, = signs pad the end: “Ma” is TWE= and “M” is TQ==. Four characters for every three bytes is why Base64 is about a third larger than the original.

Text, UTF-8 and the “garbled characters” problem

Base64 encodes bytes, not letters, so text first has to be turned into bytes. This tool uses UTF-8, the encoding of almost every web page and API, so accented letters, Arabic, Chinese and emoji survive the round trip. (A browser’s own btoa() function refuses characters outside Latin-1, a common surprise for developers.) If decoded text shows odd characters such as é where é should be, the original was probably encoded with another character set, such as Windows-1252.

If the decoded bytes aren’t text at all — an image, a PDF, a ZIP file — the tool recognizes common formats from their first bytes and offers the data as a file to download instead.

URL-safe Base64

The + and / characters have special meanings in web addresses, so RFC 4648 also defines a URL- and filename-safe alphabet, often called base64url, with - and _ instead. The = padding is usually left out. JSON Web Tokens (JWTs) use it: their header and payload are base64url-encoded JSON, separated by dots.

Worked example

The sample in the box, SGVsbG8sIHdvcmxkISDwn5GL, is 24 characters long. 24 ÷ 4 × 3 = 18 bytes, and as UTF-8 they spell “Hello, world! 👋”: thirteen one-byte characters, a space and the four bytes of the waving-hand emoji. No = is needed, because 18 bytes divide evenly into groups of three. Encoding ÿþý shows the URL-safe difference: standard Base64 gives w7/DvsO9, URL-safe gives w7_DvsO9.

Errors and what they mean

MessageUsual cause
Base64 can’t contain a characterSomething else was copied along: quotes, a comma, a label such as “Authorization:”, or non-Base64 text.
Characters can’t make whole bytesThe text was cut off while copying, or one character was added. A valid length leaves a remainder of 0, 2 or 3 when divided by 4.
An = sign before the endTwo Base64 strings were joined; decode them separately.
Mixes standard and URL-safe Base64Parts of two different encodings were pasted together.
Binary data, not textNot an error: the Base64 holds a file. Download it, or check whether you meant to encode.

Tips and limits

Everything runs in your browser: what you paste and the files you choose are never uploaded, and nothing is saved.

Frequently asked questions

Is Base64 encryption?

No. Base64 only changes how data is written, and anyone can decode it without a key. It is used so binary data can travel through systems built for text, not to keep it secret.

Why does Base64 end with = or ==?

The = signs are padding. Base64 works on groups of three bytes; when the data ends with one leftover byte, two = signs fill the group, and with two leftover bytes, one = does. Many systems, such as JWTs, leave the padding out — this decoder adds it back automatically.

How do I decode a JWT?

Split the token at the dots and paste the first part (the header) or the second (the payload) into the box: both are URL-safe Base64 of JSON. The third part is a signature, which isn’t text. Decoding doesn’t check the signature, and anyone holding a token can read its payload, so tokens shouldn’t carry secrets.

Why is my decoded text garbled?

Either the Base64 holds binary data rather than text — the tool then offers it as a file — or the text was encoded with a character set other than UTF-8, such as Windows-1252, so accented letters come out as pairs of odd characters.

How much bigger does Base64 make a file?

About 33%: every 3 bytes become 4 characters, plus up to two padding characters. A 300 KB image becomes about 400 KB of Base64, a little more with line breaks.

Embed this calculator on your website

Free for any website or blog. Paste this code where you want the calculator to appear:

All free calculator widgets

Last updated: October 15, 2026

Menu

Categories

Finance Calculators30 calculatorsBusiness & Shopping Calculators8 calculatorsHealth & Fitness Calculators12 calculatorsMath & School Calculators23 calculatorsDate & Time Calculators19 calculatorsHoliday Countdowns17 calculatorsEveryday Tools38 calculatorsMic, Camera & Sound Tools7 calculatorsImage & PDF Tools10 calculators

CalcWorthy

AboutContactPrivacy PolicyTerms of Use

Language

Language
EnglishEnglishالعربيةArabicবাংলাBanglaDeutschGermanEspañolSpanishفارسیPersianFrançaisFrenchעבריתHebrewहिन्दीHindiBahasa IndonesiaIndonesianItalianoItalian日本語Japanese한국어KoreanBahasa MelayuMalayNederlandsDutchPolskiPolishPortuguêsPortugueseРусскийRussianไทยThaiTürkçeTurkishУкраїнськаUkrainianاردوUrduTiếng ViệtVietnamese简体中文Simplified Chinese