Utilities · · 5 min read
How to Base64 Encode Text
Use the Base64 Encode tool to turn any text into Base64, with optional URL-safe output and 76-character line wrapping, right in your browser.
To Base64 encode text, open Base64 Encode, paste or type your text into the input, and copy the result — it's computed instantly in your browser, with optional toggles for a URL-safe alphabet and 76-character line wrapping.
What Base64 Encode does
Base64 turns arbitrary text (or, more precisely, the bytes behind it) into a string built only from the characters A–Z, a–z, 0–9, +, /, and the padding character =. That restricted alphabet is what makes Base64 useful: it's safe to drop into places that expect plain text but might choke on raw bytes or special characters — API tokens, data URIs, Basic Auth headers, email attachments. Toolbench's Base64 Encode tool does one job well: it's UTF-8 safe, so accented letters and emoji encode correctly, and it adds two toggles — URL-safe alphabet and Wrap at 76 chars — for the two situations where plain Base64 output needs adjusting.
How to Base64 encode text with Toolbench
- Open Base64 Encode.
- Type or paste your text into the input panel.
- Read the Base64 output — it updates as you type.
- Turn on URL-safe alphabet if the result is going into a URL, filename, or anywhere
+and/would cause problems. - Turn on Wrap at 76 chars if you need output broken into fixed-width lines, such as for a format that expects wrapped Base64.
- Click Copy to copy the result, or use Send to → to pass it straight into another tool.
Both toggles default to off, so the plain output is standard, unwrapped Base64 unless you turn them on.
A real worked example
With both toggles off, this input:
Hello, world!
produces:
SGVsbG8sIHdvcmxkIQ==
That's standard Base64: Toolbench encodes the UTF-8 bytes of your text, then maps every group of 3 bytes to 4 characters from the Base64 alphabet, padding the end with = if the input length isn't a multiple of 3.
What the URL-safe toggle actually changes
Standard Base64 can contain + and /, both of which have special meaning inside a URL. Turning on URL-safe alphabet swaps + for -, / for _, and strips any trailing = padding. Most of the time this doesn't change anything visible, because not every encoded string happens to contain a + or /. But some do. Encoding this input:
subjects?=math&english
with the toggle off gives:
c3ViamVjdHM/PW1hdGgmZW5nbGlzaA==
Notice the / right in the middle, and the == padding at the end — both would need escaping if you tried to put this directly into a URL path or query string. With URL-safe alphabet turned on, the same input gives:
c3ViamVjdHM_PW1hdGgmZW5nbGlzaA
The / becomes _, and the trailing == is gone — safe to drop straight into a URL without additional escaping.
What the line-wrap toggle actually changes
Base64 output is normally one unbroken line, no matter how long. Some older formats and tools (certain email and certificate formats, for instance) expect Base64 broken into fixed-width lines. Turning on Wrap at 76 chars inserts a line break every 76 characters. A 135-character input that would otherwise produce one 180-character line instead comes out as three lines of 76, 76, and 28 characters — the content is identical, just reformatted.
Reference: what the toggles do
| Toggle | Default | Effect |
|---|---|---|
| URL-safe alphabet | Off | Replaces + with -, / with _, and removes trailing = padding |
| Wrap at 76 chars | Off | Breaks the output into lines of 76 characters |
Tips and common mistakes
- Base64 is not encryption. It's a reversible encoding — anyone can decode it back to the original text with no key or password. Don't use it to keep anything secret.
- Turn on URL-safe alphabet before embedding Base64 in a URL, filename, or JSON key that needs to stay URL-safe. Without it, a
+or/in the output can break a URL or get double-encoded by other tools downstream. - Most short strings won't visibly change with the URL-safe toggle. Whether
+or/shows up at all depends on the specific bytes being encoded, so don't assume a given input will look different until you check. - The output is UTF-8 safe. Non-ASCII characters like accented letters and emoji are encoded correctly because the tool encodes the UTF-8 bytes of your text, not raw character codes.
- Encoding doesn't shrink your data — it grows it. Base64 output is roughly a third longer than the original bytes, since every 3 bytes become 4 characters.
Related tools
- Base64 Decode — reverse the process and turn Base64 back into text.
- Base64 / URL Encode — switch between Base64, URL percent-encoding, and HTML entity encoding in one tool.
- Image to Base64 — encode an image file as a Base64 data URI instead of text.
- Hash Generator — compute an MD5 or SHA hash of a string instead of encoding it.
Frequently asked questions
Is Base64 encoding a form of encryption?
No. Base64 is a reversible text encoding, not encryption. Anyone can decode a Base64 string back to the original text without a password or key — it's meant to make data safe to store in text formats, not to hide it.
When should I turn on the URL-safe alphabet toggle?
Turn it on whenever the encoded result is going into a URL, a filename, or anywhere else +, /, or = could cause problems. It swaps + for -, / for _, and drops the trailing = padding so the output is safe to use as-is.
Why does Base64-encoded text look longer than the original?
Base64 maps every 3 bytes of input to 4 output characters, so the encoded text is roughly 33% longer than the original. That overhead is the tradeoff for restricting the output to a safe, universal character set.
When would I need the 76-character line wrap?
Some older formats, such as certain email attachment encodings and certificate files, expect Base64 data broken into fixed-width lines rather than one long line. Turn on Wrap at 76 chars if you're producing output for one of those formats.
Is my text sent to a server?
No. Encoding happens in your browser as you type. Signed-out visitors have nothing saved; if you're signed in, your input syncs privately to your account.
More guides
- How to Base64 Decode TextUse the Base64 Decode tool to turn Base64 — standard or URL-safe, padded or not — back into readable text, right in your browser.
- How to Look Up Any IP Address or DomainEnter any IP address or domain name to see its location, ISP, timezone and ASN — domains are resolved to an IP first, automatically.
- How to Find Your Public IP Address OnlineSee your public IP address, city, region, ISP and ASN the moment the page loads, plus how to look up any other IP address or domain.