Private by design. Your text is processed in your browser and is not uploaded to Q3 Labs. It isn't stored, put in the URL, or sent to analytics.
0 characters · 0 B
Up to 2,000,000 characters. Tip: press Ctrl+Enter (Cmd+Enter on Mac) to encode.
Result
Encode some text or decode some Base64 to see the sizes here.
Free Base64 encoder and decoder online
This tool converts text to Base64 and Base64 back to text. Pick Encode or Decode, paste your input, and the result appears alongside it with its size. You can copy it, download it as a text file, or swap the output back into the input to check the round trip.
It is built for text: any language and emoji, via UTF-8. Decoding validates the input first, so a mistyped character, broken padding or a truncated string is reported rather than turned into garbled output. This version doesn't encode or decode files such as images; if a Base64 string turns out to contain binary data, the tool says so.
What is Base64?
Base64 is a binary-to-text encoding. It represents any sequence of bytes using 64 ASCII characters (A–Z, a–z, 0–9, + and /) plus = for padding. The standard version is defined in RFC 4648.
Its purpose is transport, not secrecy or size. Many systems were designed for plain text and can mangle raw bytes or unusual characters. Base64 turns anything into a safe, predictable run of letters and digits that survives email, JSON, XML, HTML attributes and configuration files unchanged.
How Base64 encoding works
- Text becomes bytes. The text is converted to bytes using UTF-8. "Hello" is 5 bytes; an emoji is 4.
- Bytes are grouped in threes. Each group of 3 bytes is 24 bits.
- 24 bits become four 6-bit numbers. Each number (0–63) picks one character from the Base64 alphabet.
- Padding fills the last group. If the data doesn't divide into threes, the output ends with one or two =.
That is why Hello encodes to SGVsbG8=: five bytes make one full group of three plus two leftover bytes, which need one padding character.
How to encode text to Base64
- Choose Encode at the top of the tool.
- Type or paste your text into the input box, or press Load Example.
- Press Encode Base64 (or Ctrl+Enter). The Base64 appears in the output box with its size.
- Copy or download the result, saved as base64.txt.
How to decode Base64 to text
- Choose Decode at the top of the tool.
- Paste the Base64 string. Line breaks and spaces inside it are fine.
- Press Decode Base64. The original text appears in the output box.
- If it's invalid, the tool explains why: an unexpected character, misplaced or missing padding, or a string that was cut off.
Base64 encoding examples
These values are produced by the same code the tool above uses.
| Example | Text | UTF-8 bytes | Base64 |
|---|---|---|---|
| Plain text | Hello World | 11 | SGVsbG8gV29ybGQ= |
| Unicode with an emoji | Hello 🚀 | 10 | SGVsbG8g8J+agA== |
| Hindi | नमस्ते | 18 | 4KSo4KSu4KS44KWN4KSk4KWH |
| HTML (encoded as text, never run) | <p class="note">Hi</p> | 22 | PHAgY2xhc3M9Im5vdGUiPkhpPC9wPg== |
Notice that "Hello 🚀" is 7 characters but 10 bytes: the rocket emoji alone takes 4 bytes in UTF-8, and Base64 encodes the bytes, not the characters.
Base64 and UTF-8
Base64 encodes bytes, so text first has to become bytes, and the usual choice is UTF-8. English letters take one byte each; accented letters, Hindi, Urdu and Arabic usually take two or three; Chinese and Japanese characters three; most emoji four. Decoding must use the same character encoding, or the text comes back garbled.
In JavaScript, the built-in btoa() only accepts characters that fit in a single byte, so calling it on "नमस्ते" or an emoji throws an error. This tool converts text with TextEncoder first and decodes with a strict TextDecoder, which is why Unicode round-trips exactly, and why Base64 that holds non-text bytes is reported instead of displayed as nonsense.
Base64 vs Base64URL
| Standard Base64 | Base64URL | |
|---|---|---|
| Characters 62 and 63 | + and / | - and _ |
| Padding | = at the end | Often omitted |
| Typical use | Email, JSON, data: URLs, configuration | URLs, filenames, JSON Web Tokens |
This tool works with standard Base64. If your value contains - or _, it tells you the value looks like Base64URL rather than silently converting it, so you always know which format you are dealing with.
Is Base64 encryption?
No. These three things are often confused, but they do different jobs:
- Encoding (Base64, URL encoding) changes how data is written so it can be transported. There is no key; anyone can reverse it.
- Encryption (AES, for example) scrambles data with a key so only someone with the key can read it.
- Compression (gzip, Brotli, ZIP) makes data smaller by removing redundancy.
Base64-encoded text looks unreadable, but it hides nothing: this page decodes it in a click. Don't rely on Base64 to protect passwords, tokens or personal data.
Is Base64 compression?
No, it works the other way. Base64 represents binary data using 64 ASCII characters, so every 3 bytes become 4 characters. Because of that, Base64 generally increases the size of the data by roughly one-third, before any line breaks some systems add. Very short inputs can grow by more, because of padding.
The tool shows the measured sizes for your own input, including how many Base64 characters you get per byte of text, rather than assuming a fixed percentage.
When is Base64 used?
- Email attachments, which travel as Base64 inside MIME messages.
- Data URLs that embed small images or fonts directly in HTML or CSS.
- Binary data in JSON or XML, which can only carry text.
- HTTP Basic authentication, where the username and password are Base64-encoded (and therefore must be sent over HTTPS).
- Tokens and identifiers, such as JSON Web Tokens, which use Base64URL.
- Configuration values such as certificates or keys stored in environment variables or Kubernetes secrets.
Base64 in APIs and web development
Developers meet Base64 constantly: decoding a token payload while debugging, reading a value from a Kubernetes secret, embedding an icon as a data URL, or sending a small file in a JSON request. For readable API payloads, pair this tool with the JSON Formatter, or shrink them with the JSON Minifier.
For large files, Base64 inside JSON costs about a third more bandwidth plus extra memory to encode and decode, so direct binary uploads are usually better. If you're designing APIs or integrations, our web app development team can help.
Limits, privacy and security
The tool accepts up to 2,000,000 characters of input, which covers everyday text comfortably while keeping your browser responsive. It is designed for text; it doesn't encode or decode files such as images or PDFs.
Your text is processed in your browser and is not uploaded to Q3 Labs. It isn't written to the URL or browser storage, and it is never sent to analytics. Decoded output is shown as plain text only: HTML or JavaScript inside it is never run or rendered. As with any web page, avoid pasting live secrets on a shared or untrusted computer.
Frequently Asked Questions
Explore more
Format or validate JSON with the JSON Formatter, make it compact with the JSON Minifier, count characters and bytes with the Character Counter or words with the Word Counter, and change text case with the Case Converter. Percent-encode values for links with the URL Encoder & Decoder. Generate IDs with the UUID Generator or build a sitemap with the XML Sitemap Generator. Browse all our free tools.
Related tools & resources
Related tools
- Favicon GeneratorGenerate favicon and web app icon files from your logo directly in your browser.
- Password GeneratorGenerate strong random passwords in your browser with custom length and character types. Nothing is uploaded.
- URL Encoder & DecoderPercent-encode or decode URLs and URI components, with encodeURI and encodeURIComponent modes. Nothing is upl…
Learn more
- Web Development GuidesPlatform choice, launch sequencing, and the technical fundamentals every website needs before it goes live.
- Web DevelopmentSlow, hard-to-maintain websites quietly cap growth by hurting Core Web Vitals, SEO, and conversion rate.
Related articles
- Top 50 Software Development Companies in England (2026 Guide)From global consultancies with London delivery hubs to boutique fintech specialists and Sheffield's game stud…
- How Much Does a Business Website CostA business website costs anywhere from $500 to $50,000, and most small businesses land between $3,000 and $15…