code

Base64 Encoder / Decoder

Encode text to Base64 or decode Base64 strings — supports Unicode

edit_calendar Last updated: Jul 22, 2026 | verified Reviewed by Calkulator Team | timer 2 min read
Developer illustration
Developer

Encode text to Base64 or decode Base64 back to text

Base64 encoding converts binary data to ASCII text — used in email attachments, data URLs, API tokens, and configuration files. Paste your text to encode, or paste a Base64 string to decode it back.

tips_and_updates Base64 increases data size by about 33% — do not use it for large files; it is meant for embedding small data inline.
Text to Encode
Base64 Output
insights
Live Result Illustration
Visual summary — updates instantly as you enter values above
LIVE
Tool Output Updates in real-time // Input Hello, World! ───────────────── Encoding: UTF-8 Length: 13 bytes // Output SGVsbG8sIFdvcmxkIQ== ───────────────────── Format: Base64 Length: 20 chars Do not paste sensitive credentials, tokens, or private keys into any online tool — use local tools for security-critical work.
tips_and_updates

Real-Life Guide to Using the Base64 Encode/Decode

Encode or decode Base64 strings. Use the examples and checks below to turn the number into a practical decision.

When this calculator is useful

Use this when you need to embed binary-safe data as text — for example inlining a small image in CSS with a data URI, decoding a JWT payload segment, or reading a Base64-encoded API credential or attachment.

For most people, the best way to use the Base64 Encode/Decode is to try the real case first, then change one input at a time. That makes the trade-off visible. For example, with a loan calculator you can change tenure while keeping the same rate; with an investment calculator you can change return assumption while keeping the same monthly contribution; with a health, education or measurement calculator you can check how much one input changes the final category.

The result should answer a practical question: Can I afford this? How much should I save? Is this score enough? Is this measurement within range? What is the safer or cheaper option? If the output does not answer the decision clearly, adjust the inputs until the scenario matches your real situation.

lightbulb Real-Life Example
Decoding a JWT payload segment: A developer inspecting a login token wants to see what data is stored inside the middle segment of a JSON Web Token.
1Pasting the middle segment eyJ1c2VySWQiOjQyLCJyb2xlIjoiYWRtaW4ifQ into the decoder (after adding the missing = padding) reveals the JSON {"userId":42,"role":"admin"} — showing exactly what claims the token carries.
2Now change one input, such as rate, time, quantity, unit or score, and compare the new result with the first one.
JWT payloads are only encoded, not encrypted, so anyone holding the token can read its contents — sensitive data should never be placed in a JWT payload unencrypted.

Practical Advice

Use the Base64 Encode/Decode as a planning tool, not just a number generator. Write down the inputs you used, because the final answer is meaningful only when you remember the assumptions behind it.

If the decision affects money, health, tax, safety, academics or legal compliance, keep a second check ready. That second check may be a bank quote, payslip, official rule, prescription, site measurement, mark sheet or invoice.

Common Mistakes

  • Treating Base64 as encryption — it is a reversible encoding scheme with no secret key, so anyone can decode it back to plaintext in seconds; never use it to "hide" passwords or tokens.
  • Forgetting padding characters (=) at the end of an encoded string when copying it manually, which breaks strict decoders expecting length divisible by 4.
  • Mixing up standard Base64 (using + and /) with URL-safe Base64 (using - and _), which matters when decoding tokens from URLs or JWTs that use the URL-safe variant.
  • Trying to decode a string that is not valid Base64 (wrong length, invalid characters) and getting garbled or truncated output instead of a clear error.
  • Assuming encoding a large file inline always saves space — Base64 output is roughly 33% larger than the original binary data, since 3 bytes of input become 4 characters of output.

How to Interpret Results

Encoding converts raw bytes or text into a plaintext-safe ASCII string; decoding reverses that back to the original bytes — if decoding produces unreadable characters, the input was likely not valid Base64 or was encoded with a different variant (standard vs. URL-safe).

A good interpretation looks at both the main result and the supporting values. If a page shows totals, ratios, categories, schedules or warnings, read those together instead of focusing only on the biggest number.

quiz

Base64 Encode/Decode FAQs

Useful answers for interpreting the output, avoiding mistakes and using the result responsibly.

What is Base64 encoding actually used for?
Base64 converts binary data into a text-safe format made of only letters, digits, +, /, and = padding, so it can be safely transmitted through systems designed for text — like embedding images in HTML/CSS, sending attachments in email (MIME), or storing binary data in JSON.
Is Base64 the same as encryption?
No — Base64 is an encoding, not encryption. It has no key and no secret; anyone can decode it instantly using this same tool or a single command-line call, so it provides zero confidentiality and should never be relied on to protect sensitive data.
Why does my Base64 string end with one or two = signs?
Base64 encodes data in 3-byte chunks that become 4 output characters; when the input length is not a multiple of 3, = padding characters are added at the end to complete the final group, so encoded output length is always a multiple of 4.
What is the difference between standard and URL-safe Base64?
Standard Base64 uses + and / in its character set, which have special meaning inside URLs, so URL-safe Base64 replaces them with - and _ instead (and often omits padding). JWTs and many web APIs use the URL-safe variant, which will fail to decode correctly with a strict standard decoder.
Why did decoding my string produce garbled or broken output?
This usually means the input was not valid Base64 to begin with — often from missing padding, extra whitespace or line breaks copied in accidentally, or the string actually being URL-safe Base64 rather than standard. Double-check the source and try re-copying without surrounding text.
Does encoding a file to Base64 make it smaller?
No, it makes it larger — Base64 output is about 33% bigger than the original binary because every 3 bytes of input expand into 4 characters of output. It is used for compatibility with text-only systems, not for compression.
Can I encode an entire image or file with this tool, or just text?
This tool is built for encoding and decoding text strings directly typed or pasted in. For encoding entire files (like images into data URIs), you would typically use a file-upload-capable encoder or a command-line tool, since browser text fields are not ideal for large binary uploads.
Is it safe to paste an API key or password here to encode it?
Encoding happens locally in your browser and nothing is sent to a server, so it is technically safe from a network standpoint, but remember that Base64-encoding a secret does not protect it — it only changes its representation, so never share the encoded string as if it were secured.

What is Base64?

Base64 is an encoding scheme that represents binary data as ASCII text using 64 printable characters (A–Z, a–z, 0–9, +, /). It's commonly used to embed images in HTML/CSS, encode email attachments (MIME), store binary data in JSON, and pass data through systems that only handle text.

Base64 increases data size by ~33% (every 3 bytes becomes 4 characters). It is NOT encryption — it's trivially reversible. Never use it to "hide" sensitive data. This tool handles Unicode text correctly by using UTF-8 encoding before Base64 conversion.

lightbulb Example
Encode "Hello":
1ASCII bytes: 72 101 108 108 111
2Base64: SGVsbG8=
✓ 5 chars → 8 chars (+60% size)

quizFrequently Asked Questions

What is Base64 used for?
Base64 encodes binary data (images, files, audio) into printable ASCII characters so it can be embedded in text-based formats like JSON, XML, HTML, and email (MIME). It's not encryption — it's encoding. Common uses: embedding images in CSS as data URIs, encoding binary API payloads, and storing binary data in databases that only support text.
Does Base64 increase file size?
Yes, by approximately 33%. Every 3 bytes of binary data become 4 Base64 characters. A 1 MB image encoded as Base64 becomes ~1.37 MB. This overhead is why Base64 is used for convenience (embedding) rather than storage efficiency.
What's the difference between standard Base64 and URL-safe Base64?
Standard Base64 uses + and / characters, which have special meanings in URLs. URL-safe Base64 replaces + with - and / with _, making it safe to include in URLs and query strings without percent-encoding. Many APIs (like JWT tokens) use URL-safe Base64.
keyboard_arrow_up