Base64 Encoder / Decoder

Encode text to Base64 or decode Base64 back to text.

Mode

Enter plain text to encode, or Base64 to decode (based on the mode above).

Scroll inside the box for long output; the copy button stays in view.

Formula used

Encoding (UTF-8):
  bytes   = UTF-8 encode of the input string
  base64  = base64(bytes)   // 3 bytes -> 4 chars, '=' padding to a multiple of 4

Decoding:
  bytes   = base64 decode of the input
  text    = UTF-8 decode of bytes

Worked example

Mode: Encode   Input: Hello

Result: SGVsbG8=

Switch to Decode with the same value and you get Hello back.

Base64 is one of those utilities you rarely notice but use constantly. Its entire job is to solve one problem: move data that is not text through a channel that only understands text. Email was built around plain characters, so attachments are Base64-encoded before they travel and decoded when they arrive. JSON has no native binary type, so APIs that need to carry an image, a PDF, or a signature blob embed it as a Base64 string. The HTTP Basic Auth scheme transmits credentials as base64(username:password). And the data URI scheme that lets CSS or HTML contain an asset inline — data:image/png;base64,… — is simply Base64 wrapped in a prefix. Once you see Base64 as the bridge between binary and text rather than a confusing string of letters and equals signs, every place it appears in a stack becomes a deliberate, understandable choice instead of a mystery.

The most frequent real task is converting a small image or icon into a data URI so it can be inlined directly into a stylesheet or markup. For tiny assets like logos, spinner graphics, or favicons, inlining removes an extra network round trip and avoids the render-blocking delay of fetching a separate file, which is a measurable improvement on slow mobile connections. A second common workflow is decoding a Base64 blob you received from an API or a webhook so you can actually read the payload — switch to decode mode, paste the string, and see the underlying JSON, token, or message instead of an opaque wall of characters. Front-end and QA engineers also use it to build test fixtures: encode a known input to confirm a backend decodes it the same way, or decode a captured token to inspect what a service is really sending. When you are constructing a signed link or a state parameter that must survive a trip through a URL, Base64 lets you pack structured data into one opaque value that downstream systems can unpack reliably. It is important to internalize that Base64 does not compress data — it enlarges it. The scheme takes every three bytes of input and turns them into four characters of output, so the encoded result is consistently about a third larger than what you started with. That expansion is the unavoidable cost of restricting the output to a safe, universally transportable 64-character alphabet. The practical implication is to reserve Base64 for small payloads and use genuine binary transport for anything large: a separate file, a multipart upload, or a CDN URL will always beat a giant inlined blob. Embedding a multi-megabyte photograph as a data URI will balloon your HTML or JSON, slow parsing, and undermine the exact performance you were trying to gain. If your real goal is to make data smaller, reach for actual compression such as gzip or brotli applied around the data — Base64 is about safe transport, never about saving space, and conflating the two is a classic source of bloated pages. The one rule that matters most is that Base64 is encoding, not encryption. There is no key, no secret, and no protection — anyone holding the encoded string can decode it instantly, so it offers zero confidentiality. Never use it to "hide" passwords, API keys, or personal information; at best it is light obfuscation, and at worst it creates a dangerous false sense of security. The same caution applies to HTTP Basic Auth: those credentials are only Base64, so they must be sent over TLS or they are effectively readable by anyone on the path. A second correctness detail is the alphabet itself: standard Base64 uses + and /, which are illegal inside URLs and filenames, so a URL-safe variant substitutes - and _ and often drops padding. If a value decodes wrongly after passing through a link, that alphabet mismatch is usually the cause. Finally, Base64 can only faithfully reproduce data it was given — decoding an image back to "text" yields nonsense characters, which is expected behavior, not a defect. Use decode for things that were text or known binary, and you will never be surprised.

This tool works in two directions, and picking the right one saves time. Use encode when you have raw text, source code, or credentials you need to embed in a text-only context such as a configuration file, a JSON field, or an email header. Use decode when you have received a Base64 string and need to inspect or reuse what it actually contains — debugging a saved token, recovering a pasted payload, or verifying that two systems agree on a value. A frequent point of confusion is double-encoding: running already-encoded text through encode again produces a different, longer string that will not decode in one step, so if a decode attempt returns more Base64 rather than readable content, the input was likely encoded twice. Keeping the direction intentional, rather than guess-and-check, is the habit that makes this utility feel effortless instead of fiddly.

Frequently asked questions

What is Base64 used for?

Base64 turns binary data into plain text so it can travel through systems that only handle text, like email, JSON, or URLs. It is encoding, not encryption — anyone can decode it.

Is Base64 secure?

No. Base64 is reversible and provides no secrecy. Never use it to hide passwords or sensitive data; use proper encryption for that.

Why is my decoded text garbled?

The input was not valid Base64, or it was Base64 of non-text data such as an image. This tool decodes to UTF-8 text, so binary files will look like nonsense.

Does it handle Unicode and emojis?

Yes. Encoding uses UTF-8, so accents, Chinese characters, and emojis survive the round trip intact.