What is Base64 Encoder / Decoder?
A Base64 Encoder / Decoder computes base64 encoder / decoder from the inputs you provide. It applies the standard formula to the values you enter and returns the result instantly, without sending any data to a server. Standard and URL-safe variants.
Base64 Encoder / Decoder
Encode and decode Base64 in your browser. Standard and URL-safe variants.
TLDR
Type or paste, click Encode or Decode. Standard Base64 uses A-Z a-z 0-9 + / =. URL-safe Base64 replaces + with - and / with _ and strips padding. The tool detects which way you want by trying to decode; if it fails it encodes instead.
How to use this tool
- Enter your inputs. Each field is labeled with what it expects.
- Read the result instantly. Numbers update as you type or change inputs.
- Adjust to test sensitivity. Change one input at a time to see what moves the result most.
- Cross-check the formula in the section below if you want to verify the math.
- Copy or screenshot the result for later. The site does not save anything; close the tab and inputs are gone.
About this tool + how it works
This tool runs 100% in your browser - the libraries load from a public CDN and the math runs on your device. Nothing is uploaded to a server. The underlying logic is:
encode = btoa(utf8(text)) decode = utf8(atob(text))
You can verify by opening the browser developer tools and watching the Network tab; you'll see no requests fired during normal use beyond the initial page and library load.
How Base64 actually works
Base64 solves a specific problem: how to move arbitrary binary data through channels that were built for plain text, such as email bodies, JSON strings, URLs, and HTML attributes. Those channels can mangle or strip raw bytes, so Base64 re-expresses any byte stream using only 64 safe characters: A to Z, a to z, 0 to 9, plus the two symbols + and /. The result is text that survives transport intact.
The mechanism works in groups of three bytes. Three bytes are 24 bits, which split evenly into four 6-bit chunks, and each 6-bit value (0 to 63) maps to one character in the Base64 alphabet:
3 bytes (24 bits) -> 4 Base64 chars (4 x 6 bits) "Man" = 77, 97, 110 01001101 01100001 01101110 (24 bits) 010011 010110 000101 101110 (regrouped into 6-bit) 19 22 5 46 (decimal values) T W F u (Base64 alphabet) "Man" -> "TWFu"
When the input length is not a multiple of three, Base64 pads the final group with one or two = signs so the output length is always a multiple of four. This is why encoded strings so often end in = or ==.
Encoded size and variant reference
Base64 always grows the data by about one third, because every 3 bytes become 4 characters. Plan storage and bandwidth around this overhead:
| Input bytes | Base64 length | Padding | Overhead |
|---|---|---|---|
| 1 byte | 4 chars | == | +300% |
| 2 bytes | 4 chars | = | +100% |
| 3 bytes | 4 chars | none | +33% |
| 100 bytes | 136 chars | none | +36% |
| 1 KB | ~1.37 KB | varies | ~+33% |
Two common variants matter in practice. Standard Base64 uses + and / and is fine for email and JSON. Base64URL swaps those for - and _ and usually drops padding, so the string drops straight into a URL or filename without percent-encoding. Decoding either is the same process in reverse.
Real-world scenarios where this tool helps
Quick conversion
Paste, convert, copy - faster than spinning up a Python REPL.
Learning
See exactly how base64 encoder / decoder works step by step.
Debugging
Verify encoding / decoding output when integrating with APIs.
Mock data
Generate properly-encoded test fixtures.
What this tool does
- Runs the base64 encoder / decoder 100% in your browser - no upload, no API, no signup.
- Shows live error messages when input is malformed.
- One-click Copy, Sample, and Clear buttons.
- Works on phones, tablets, and desktops; loads in under a second.
- Free forever; no premium tier.
What it does NOT do
- Does not store, log, or send your input anywhere.
- Does not require an account, an API key, or a paid plan.
- Does not fix malformed input - garbage in = error message.
- Does not preserve formatting nuances that the target encoding cannot express.
Common mistakes and pitfalls
- Pasting input that includes extra whitespace or quotes the encoding does not allow - clean the input first.
- Expecting reversed conversion to give byte-identical original when the encoding is lossy (some text -> binary -> text round-trips can lose multibyte chars if encoding is wrong).
- Mixing encodings (e.g., URL-encoded text inside a base64 string) - decode in the right order.
- Forgetting that some encodings have multiple valid forms (uppercase vs lowercase hex, padded vs unpadded base64).
Frequently asked questions
Is this tool free?
Yes - free forever, no signup, no daily limit.
Where does my input go?
Nowhere. The conversion runs entirely in your browser. Nothing is uploaded, stored, or logged.
Does it work offline?
After first load yes. The page caches in your browser and works without a connection.
Will it handle large inputs?
Yes up to several megabytes. The transforms are O(n) and the browser handles MBs in milliseconds.
Is the output exactly correct?
Yes - these are deterministic transforms with well-defined output. Same input always gives the same output.
Why does the round trip not produce byte-identical output for some inputs?
Some encodings are lossy on the second pass (e.g., trailing whitespace, BOM markers, or null bytes can be stripped). For binary-safe round trips use base64 or base32 which are designed to be lossless.
Is the encoded output safe to put in a URL?
Depends on the encoding. Base64 contains '+' and '/' which need URL-encoding; use Base64URL (in tools that offer it) for direct URL use. Hex, binary, and decimal are URL-safe by definition.
Can I encode/decode files instead of text?
Not on this page - the input box accepts text. For binary files use a dedicated tool that reads the file as bytes. Alternatively paste the file's contents if it is small.
How does this differ from the CLI tools (base64, xxd, od)?
Functionally identical for valid input. The CLI handles huge files better. This tool wins on convenience: paste a string, see the result in milliseconds, no terminal needed.
What encoding does the tool assume for text?
UTF-8 everywhere. The TextEncoder API encodes input strings as UTF-8 bytes, and TextDecoder reads them back. ASCII-only input works identically; non-ASCII characters use 2-4 bytes each in UTF-8.
