Base64 Encode / Decode
How do I encode Base64?
Result
How it is calculated
Base64 rewrites bytes using 64 safe characters: A to Z, a to z, 0 to 9, plus and slash, with equals signs as padding. Encoding takes your text as bytes, groups them in threes (24 bits), and splits each group into four 6-bit values, each mapped to one character. If the last group is short, one or two = are added. Output is about 4 × ⌈n ÷ 3⌉ characters for n input bytes, roughly one third larger. Decode mode reverses this in strict mode; if the input is not valid Base64, the tool shows an invalid-input message instead of text. Base64 is an encoding, not encryption: anyone can reverse it.
Worked example
Encode the text Hello, World! in encode mode. It is 13 bytes, which is four full groups of three plus one leftover byte. The first twelve bytes give 16 characters, SGVsbG8sIFdvcmxk. The last byte, the exclamation mark, produces IQ and two = padding signs to fill the final group of four. The tool outputs SGVsbG8sIFdvcmxkIQ==, 20 characters. Switching to decode mode and pasting that string returns the original text.
Common mistakes
- Treating Base64 as encryption. It hides nothing; never use it to protect passwords or secrets.
- Pasting a string that has line breaks, spaces or a missing padding sign into decode mode. Decoding is strict and will report invalid input.
- Decoding with the wrong mode selected. Running encode on an already encoded string produces a longer, double-encoded string.
- Decoding the URL-safe variant, which uses
-and_instead of+and/. Swap those characters first. - Expecting readable output when decoding binary data such as an image. The bytes are not text and will look like garbage.
About this calculator
This tool encodes plain text into Base64, a scheme that represents binary data using only 64 printable ASCII characters (A–Z, a–z, 0–9, + and /), or decodes a Base64 string back into its original readable text. Base64 does not compress or encrypt data — it purely re-encodes it into a format guaranteed to survive systems that only handle text safely.
It is used throughout web development and networking wherever binary-safe data needs to travel through text-only channels: embedding small images directly inside CSS or HTML, encoding attachments in emails, packing authentication tokens and credentials into HTTP headers and URLs, and storing binary blobs inside JSON or XML payloads. Developers reach for a quick Base64 encoder or decoder constantly when debugging API requests, inspecting JWT tokens, or preparing data for an interface that can only accept plain text.
Was this helpful?
You can pick up to 3 reactions.
Popular calculators
Loan Calculator
Monthly payment, total interest and full amortization schedule.
Percentage Calculator
Percent change, percent of, and ratio calculations.
Discount Calculator
Calculate final price, savings, and discount amount.
BMI Calculator
Body mass index from height and weight (metric or imperial).
Age Calculator
Compute your exact age in years, months and days from a birth date.
Compound Interest Calculator
Calculate the final amount and interest earned with compounding.
All Calculators
- Loan Calculator
- Profit Calculator
- Discount Calculator
- BMI Calculator
- Percentage Calculator
- Ideal Weight Calculator
- Age Calculator
- Pregnancy Due Date Calculator
- Compound Interest Calculator
- BMR Calculator (Basal Metabolic Rate)
- Tip Calculator
- Fuel Cost Calculator
- Date Difference Calculator
- Sleep Cycle Calculator
- Daily Water Intake Calculator
- Simple Interest Calculator
- Heart Rate Zones Calculator
- Running Pace Calculator
- Pet Age Calculator
- Calories Burned Calculator
- Macro Calculator
- TDEE Calculator (Total Daily Energy Expenditure)
- Waist-to-Hip Ratio Calculator
- Honor Roll Calculator
- One Rep Max (1RM) Calculator
- Ovulation Calculator
- Electricity Cost Calculator
- Unit Price Calculator
- Savings Goal Calculator
- Break-Even Point Calculator
- Paint Calculator
- Course Grade Average Calculator
- Business Days Calculator
- Time Duration Calculator
- Fuel Economy Calculator
- Temperature Converter
- Tile Calculator
- Aspect Ratio Calculator
- Roman Numeral Converter
- Goal Weight Timeline Calculator
- Salary Converter (Hourly to Annual)
- Credit Card Validator (Luhn)
- Body Surface Area (BSA) Calculator
- Feels-Like Temperature Calculator
- Ohm’s Law Calculator
- PPI (Pixel Density) Calculator
- Molar Mass Calculator
- Zodiac Sign Calculator (Western + Chinese)
- IBAN Validator
- Shoe Size Converter
- Country Info & Dialing Code Lookup
- Time Zone Difference (World Clock)
- CAGR (Compound Annual Growth Rate) Calculator
- Rule of 72 Calculator
- Blood Alcohol Content (BAC) Calculator
- Lean Body Mass (LBM) Calculator
- Pythagorean Theorem Calculator
- Speed Converter
- Download Time Calculator
- Date Calculator (Add/Subtract)
No calculators found
Comments (1)
Base64 is an encoding, not encryption: anyone can reverse it, so never use it to hide a password or token. Text is encoded as UTF-8 bytes, which means accented letters and emoji give longer output than plain ASCII. Decoding is strict, so URL-safe variants that use - and _ in place of + and / will show as invalid until you swap them back. If a decode succeeds but the text looks garbled, the source was probably binary. What are you decoding?