Base64 Encode Decode
Free Base64 encoder and decoder for converting text or files to/from Base64 representation. Standard for embedding binary data in text contexts (data URIs, JSON, email).
Share on Social Media:
Base64 Encode Decode: Convert Text and Files Instantly in Your Browser
Sooner or later every developer meets a string like eyJhbGciOiJIUzI1NiJ9 and needs to know what it actually says. The Base64 Encode Decode tool answers that question in one click: paste the string, hit decode, and read the original text. Run it the other way to turn readable text, JSON, or a short snippet into a clean Base64 block you can drop into a header, a config file, or a data URI. There is nothing to install, no account, and no daily cap.
Take that example string. Decode eyJhbGciOiJIUzI1NiJ9 and you get {"alg":"HS256"} — the header of a JSON Web Token. Encode Hello, World! and you get SGVsbG8sIFdvcmxkIQ==. The math is fully reversible, so whatever you put in comes back out byte-for-byte, which is exactly why people search for base64 encode decode online when a string refuses to behave. The conversion runs in your own browser, so a simple text encode or decode never has to leave your machine.
What Base64 Actually Is
Base64 represents binary data using only 64 printable characters: the uppercase letters A–Z, the lowercase letters a–z, the digits 0–9, and the two symbols plus (+) and slash (/). An equals sign (=) pads the end. That alphabet was chosen because every one of those characters survives a trip through email systems, URLs, JSON fields, and HTTP headers without being altered. The trade-off is size: Base64 output is always about 33 percent larger than the input.
How encoding works, byte by byte
Computers store everything as 8-bit bytes. Base64 takes your data three bytes at a time — that is 24 bits — and slices those 24 bits into four groups of 6 bits. Each 6-bit group holds a value from 0 to 63, and that number maps to one character in the Base64 alphabet. So every three bytes of input become four characters of output.
Walk through the word Man. The three letters are the bytes 77, 97, 110, which in binary are 01001101 01100001 01101110. Regroup those 24 bits into sixes: 010011 010110 000101 101110. Those values are 19, 22, 5, 46, which map to T, W, F, u. So Man encodes to TWFu — a perfect three-into-four conversion with no padding needed.
Now encode just M. One byte is only 8 bits, which does not fill even two 6-bit groups cleanly, so the encoder pads with zeros and appends equals signs to keep the output a multiple of four. M becomes TQ==, and Ma becomes TWE=. That is why you so often see one or two trailing equals signs: they tell the decoder how many real bytes the final group held.
How decoding works
Decoding reverses the process exactly. The tool reads four characters at a time, turns each back into its 6-bit value, stitches the bits together into 24, and splits them into three bytes. The padding tells it whether to keep three, two, or one byte from that final group. The operation is lossless: you always recover the precise bytes you started with.
Base64 is encoding, not encryption
This is the single most important thing to internalize. Base64 hides nothing. Anyone can decode cGFzc3dvcmQ= back to password in under a second, exactly as this tool does. It is a transport format, an envelope, not a lock. Treating a Base64 value as "scrambled enough to expose" has caused real breaches. If something must stay confidential, encrypt it with a real algorithm first and keep the key separate; Base64 only makes the ciphertext text-safe afterward.
How to Base64 Encode and Decode
The workflow is deliberately short. You do not need to know any programming language to get a correct result.
- Choose your direction. Pick "Encode" to turn readable text into a Base64 string, or "Decode" to turn a Base64 string back into the original.
- Paste your input. For encoding, drop in any plain text, JSON, XML, or code snippet. For decoding, paste the full Base64 string exactly as you received it, equals signs and all.
- Run the conversion. Click the button. The result appears immediately in the output field — well under a second even for a large block of text.
- Copy the result. Use the copy button and paste it wherever you need it: a config file, an API client, a chat message.
If you pick the wrong direction, switch and run again without re-pasting. Because the work happens locally, there is no network round-trip and no limit on how many times you run it.
Worked Examples You Can Verify
The fastest way to trust a converter is to check it against values you can reason about. Try these in the tool and confirm the output matches:
| Input (text) | Base64 output | Note |
|---|---|---|
Man | TWFu | Clean 3-into-4, no padding |
Ma | TWE= | One pad char (2 input bytes) |
M | TQ== | Two pad chars (1 input byte) |
Hello, World! | SGVsbG8sIFdvcmxkIQ== | Punctuation and a space |
user:pass | dXNlcjpwYXNz | Shape of an HTTP Basic Auth value |
{"alg":"HS256"} | eyJhbGciOiJIUzI1NiJ9 | A real JWT header |
Notice the padding pattern: a single trailing = means the final group had two bytes, and == means it had one. A correctly formed standard Base64 string is always a multiple of four characters long. If yours is not, something was truncated or a character was dropped in copy and paste.
Real Situations Where This Tool Earns Its Place
Base64 solves one specific problem — moving binary or special-character data through systems built for plain text — and it shows up constantly once you start looking. These are the cases people actually hit:
- Debugging a JWT. A token is three Base64 sections separated by dots. Paste the middle section to decode the payload and read the claims, the
expexpiry, and the user ID without writing a line of code. (JWTs usually use the URL-safe variant — see below.) - Inspecting a Basic Auth header. HTTP Basic Auth sends
username:passwordas one Base64 blob after the wordBasic. DecodedXNlcjpwYXNzto confirm it isuser:pass, or encode a fresh pair when testing an endpoint. - Reading a Kubernetes Secret. Values in a Secret manifest are stored as Base64, not encrypted. Decode the value under
data:to verify what is actually deployed, or encode a new value before applying it. - Building a data URI. A tiny icon or font can be embedded inline as
data:image/png;base64,...to save a network request. Encode the asset, prepend the prefix, and drop it into your CSS. - Recovering a MIME email part. Email transmits attachments as Base64. Looking at a raw message, decode the relevant section to recover the original content.
- Sharing fragile text. A string with line breaks, quotes, or characters that break a form field becomes a safe single-line block once encoded — it survives copy and paste intact, then decodes back perfectly.
In every one of these the alternative is opening a terminal, recalling the exact syntax, and hoping you do not mangle a special character along the way.
Standard Base64 vs URL-Safe Base64
Here is the wrinkle that trips up the most people. Standard Base64 uses + and /, but both have special meaning inside URLs and filenames: + can be read as a space, and / separates path segments. The URL-safe variant fixes this by swapping + for hyphen (-) and / for underscore (_), and it often drops the trailing equals signs entirely.
This matters most with JWTs, OAuth flows, and anything that lands in a query string. The signal is visual: if a string contains hyphens or underscores, you are almost certainly looking at the URL-safe alphabet. A token that fails to decode under one alphabet frequently works perfectly under the other, so when you copy a value out of a URL, glance at those characters before assuming the data itself is broken.
Cross-Checking Output From Your Code
Searches like base64 encode decode python, base64 encode decode java, and base64 encode decode c# are popular because every language has its own slightly different API for the same format. The bytes are identical underneath, which is exactly why an online tool is so useful for confirming your code did the right thing.
- Python:
base64.b64encode()andbase64.b64decode()work on bytes, not strings — the classic bug is forgetting to call.encode()on your text first, then wondering why you get aTypeError. - Java:
java.util.Base64gives yougetEncoder()andgetDecoder(); usegetUrlEncoder()for the URL-safe alphabet. Legacy Apache Commons Codec sometimes wraps output at 76 characters, which can confuse a strict decoder. - C#:
Convert.ToBase64String()andConvert.FromBase64String()are the tidiest one-liners; the decoder throwsFormatExceptionif the length is not a multiple of four. - JavaScript: the browser's
btoa()andatob()handle Latin-1 fine but choke on characters above U+00FF, so encoding an emoji needs aTextEncoderstep first.
When your program produces a string another system rejects, paste both your output and the expected value here and compare. If they decode to the same bytes, the format is fine and the bug is elsewhere; if they differ, you have caught the encoding mistake before it shipped.
Edge Cases and Troubleshooting
My decoded text looks like random symbols
Almost always one of two things. Either the input was not valid Base64 to begin with, or it was the URL-safe variant and the decoder expected standard. Check for hyphens and underscores, and confirm you copied the whole string with no missing characters and no stray spaces or newlines pasted in.
The decoder rejects a string that looks fine
Valid standard Base64 length is always a multiple of four, reached with padding equals signs. If a value was copied with its trailing = stripped — some systems do this deliberately — or it picked up a line break, the decoder can refuse it. Re-copy the original carefully and make sure no character outside the alphabet sneaked in.
My encoded string is longer than the original
Expected and correct. Output is roughly 33 percent larger because four characters represent every three bytes. That growth is the price of making binary data text-safe, and it is identical in every language and every tool.
Encoding emoji and non-Latin scripts
The tool handles full Unicode, so emoji, accented letters, and characters from non-Latin scripts all round-trip correctly. If you see odd output, the problem is nearly always a character-encoding mismatch in the system that produced the text, not in the Base64 step itself.
Do I need to strip whitespace before decoding?
The tool tolerates incidental whitespace, but the cleanest practice is a single continuous string. If a value was wrapped across multiple lines for display, join it back into one line to remove any ambiguity.
Handling Larger Inputs
Base64 is most often used on short strings — tokens, headers, secrets — but the tool comfortably handles substantial blocks: a full config file, a PEM certificate, or a lengthy JSON payload. The conversion still completes nearly instantly because the work happens locally rather than over a network. If you have a handful of small strings to check, keep the tab open and run them one after another, copying each result as you go. For automating thousands of items you would want a script, but for "I have a few of these to verify," doing it by hand here beats wiring up code and confirms every result visually.
Privacy: Why Browser-Based Conversion Matters
Because Base64 so often carries an auth header, a session token, or a config secret, where the conversion happens is a genuine concern. Text conversions in this tool run client-side using the device's built-in capabilities, so a simple encode or decode does not ship your data to a remote server, and nothing is stored, logged, or watermarked.
Apply common sense anyway. Never paste live production credentials, real API keys, or personal data into any online tool you do not control, even one that processes locally. Once a string is decoded it is plain text, so treat decoding a secret as if you were reading it aloud. The tool gives you a fast, private way to work; the judgment about what is safe to convert always stays with you.
Related Tools
If the Base64 Encode Decode tool is useful to you, these other free utilities on Tools Hub pair naturally with it:
- URL Encode Decode — convert characters that are unsafe in web addresses, a perfect companion when you are debugging links and query strings alongside Base64 tokens.
- JSON Formatter — once you decode a JWT payload or an API response, paste the JSON here to pretty-print and validate it.
- HTML Encode Decode — escape and unescape HTML entities, handy when Base64 data URIs are embedded directly in markup.
- Hash Generator — produce MD5, SHA-1, and SHA-256 hashes when you need real one-way fingerprints rather than reversible encoding.
- Image to Base64 Converter — turn picture files into inline data URIs for embedding directly in your HTML and CSS.
- Text Case Converter — quickly reformat text before or after you encode it for a downstream system.
Frequently Asked Questions
Is the Base64 Encode Decode tool really free?
Yes, completely free. There is no trial period, no premium tier, and no hidden charge. You can encode and decode as many strings as you want, as often as you want, at no cost.
Do I need to create an account or sign up?
No. There is no sign-up, no login, and no email required. Open the page and start converting immediately. We do not gate any feature behind registration.
Does the tool add a watermark or modify my output?
Never. The output is the exact, mathematically correct Base64 or decoded text with nothing appended, prepended, or altered. What you get is pure, copy-ready data with no branding inserted into it.
Is my data private when I use this tool?
Text conversions are processed in your browser, so a simple encode or decode does not require uploading your content to a server. We do not store or share what you paste. As a best practice, still avoid pasting live production secrets into any online tool, since decoding always reveals the original plain text.
Is Base64 a form of encryption?
No, and this is critical to understand. Base64 is encoding, not encryption. Anyone can decode a Base64 string instantly, exactly as this tool does. It scrambles nothing and protects nothing. Use real encryption for anything that must stay confidential.
Why would I encode something to Base64 in the first place?
Base64 lets you carry binary data or text with awkward characters through systems that only accept plain text, such as email, URLs, JSON fields, and HTTP headers. It guarantees the data arrives unchanged on the other side.
Can I use this tool to decode a JWT?
Yes. A JWT has three Base64-encoded parts separated by dots. Paste the header or payload section into the decoder to read its contents as JSON. Keep in mind JWTs typically use the URL-safe Base64 variant, so watch for hyphens and underscores.
Why does my Base64 string end in one or two equals signs?
The equals signs are padding. One = means the final group of input was two bytes, and == means it was a single byte. They keep the output length a clean multiple of four so the decoder knows exactly how many real bytes to reconstruct.
What is the difference between this and a URL encoder?
Base64 represents arbitrary data using 64 safe characters, while URL encoding replaces unsafe characters with percent-codes specifically for web addresses. They solve related but different problems, and our separate URL Encode Decode tool handles the latter.
Is there a limit on how much text I can convert?
There is no enforced daily or per-conversion limit for normal use. The tool handles everything from a short token to a large configuration block quickly, because the work happens right on your device.
🔗 Relevant Tools
Link to this tool
Found this tool useful? Add it to your website or blog with one of these snippets.
Add the live, working tool to your own page:
Leave a comment
Comments go straight to our team — they are not published on the site.