TOOLS WORLD logoTOOLS WORLD

Base64 Encoder & Decoder

Convert text or binary data to Base64 and back with a single click. Supports URL-safe encoding, file input, and one-click copy for both encoded and decoded output.

Base64 output

What is Base64 encoding?

Base64 is a way to represent arbitrary bytes using only printable ASCII characters. It takes every three bytes of input, groups their 24 bits into four 6-bit chunks, and maps each chunk to one of 64 symbols: uppercase letters, lowercase letters, digits, +, and /. If the input length is not a multiple of three, padding with = is added at the end.

The encoding increases size by roughly 33%, but the result can be pasted into JSON, XML, email bodies, query strings, and log files without corrupting special characters. That is why APIs return small binary blobs as Base64 strings and why developers reach for Base64 when a transport layer is text-only.

This encoder and decoder runs entirely in your browser. Paste plain text to encode it, or paste a Base64 string to recover the original text. Switch between modes with one click, load a sample to try the tool, and copy the output when you are done. No account, no upload, no waiting.

How to use the Base64 encoder and decoder

  1. Choose a mode. Select Encode to turn plain text into Base64, or Decode to reverse the process.
  2. Paste your input into the left panel. Click Load sample if you want to see an example first.
  3. Click Convert. The result appears in the right panel. If the input is invalid Base64 during decode, an error message explains what went wrong.
  4. Copy the output with the Copy button above the result panel, or click Clear to start over.

Examples

Encoding plain text

Input:  Hello, World!
Output: SGVsbG8sIFdvcmxkIQ==

The output is longer than the input because each group of three characters becomes four Base64 symbols. The trailing == is padding - it tells the decoder that the last group was not a full three bytes.

Decoding back to text

Input:  SGVsbG8sIFdvcmxkIQ==
Output: Hello, World!

Decoding is deterministic: the same Base64 string always produces the same bytes. If you are debugging API responses that contain Base64 fields, pair this tool with the JSON Formatter to inspect the surrounding structure first.

Base64 vs other encodings

Base64 is often confused with URL percent-encoding or hexadecimal representation, but they serve different jobs. Percent-encoding (also called URL encoding) replaces unsafe characters in URLs with %XX sequences - useful for query parameters, not for arbitrary binary. Hex encoding doubles every byte into two characters and is common in cryptography and checksums. Base64 is more compact than hex and handles full byte ranges, which is why it dominates web APIs and data URIs.

For URL query values specifically, use the dedicated URL Encoder Decoder, which applies encodeURIComponent or encodeURI rules instead of Base64.

Common pitfalls

  • Line breaks in pasted Base64. Email clients and some editors wrap long strings. This tool strips whitespace before decoding, so wrapped input usually works without manual cleanup.
  • UTF-8 text. The encoder uses UTF-8 bytes before applying Base64, so accented characters and emoji encode and decode correctly in modern browsers.
  • Assuming encryption. Base64 is reversible by design. If you need confidentiality, use TLS in transit and proper encryption at rest - not Base64.
  • Binary files. This tool is optimized for text. Large files or non-text binary are better handled with dedicated file utilities or command-line tools like base64 on Linux and macOS.

When developers reach for Base64

You will see Base64 in Basic Authentication headers, where username:password is encoded and sent after the Basic prefix. Data URIs embed small images directly in HTML or CSS as data:image/png;base64,.... Some databases and NoSQL stores store binary columns as Base64 strings in JSON exports. JWT tokens use Base64url (a URL-safe variant) for their header and payload segments.

Understanding encode and decode is a basic skill for API debugging, log analysis, and quick data inspection. Keep this tool bookmarked next to the Unix Timestamp Converter and JSON Validator for a complete browser-side debugging kit.

Frequently asked questions

What is Base64 encoding used for?
Base64 turns binary data into ASCII text so it can travel safely through systems that only handle plain text. Common uses include embedding small images in HTML or CSS, carrying credentials in HTTP Basic Auth headers, serializing tokens in JWT payloads, and attaching files to JSON or XML documents.
Does Base64 encrypt my data?
No. Base64 is an encoding scheme, not encryption. Anyone can decode a Base64 string back to the original bytes in seconds. Never treat Base64 as a security measure - use proper encryption if the data must stay secret.
Why does my decoded output look like gibberish?
Base64 only represents bytes. If the original data was an image, a compressed file, or UTF-8 text decoded with the wrong character set, the result will not look like readable text. Make sure you are decoding data that was actually text, and that no extra whitespace or line breaks were introduced during copy-paste.
Is it safe to encode sensitive data here?
Yes, in the sense that nothing leaves your browser. This tool uses the Web APIs TextEncoder, TextDecoder, btoa, and atob locally on your device. Your input is never sent to a server. Remember though that Base64 itself does not protect secrets - encoding a password does not make it safe to share.
What characters are valid in a Base64 string?
Standard Base64 uses letters A-Z, a-z, digits 0-9, plus + and /, with = used as padding at the end. URL-safe variants swap + for - and / for _. This decoder accepts standard Base64 and ignores whitespace, so pasted values wrapped across multiple lines still decode correctly.

Related tools

More free tools you might find useful alongside the Base64 Encoder & Decoder.