Base64 Encode & Decode Online Free
TL;DR — the short answer
To encode text to Base64, paste it into an encoder — “Hello” becomes SGVsbG8=. To decode, paste the Base64 string into a decoder and switch to decode mode. Base64 is encoding, not encryption: anyone can reverse it, so never use it to hide secrets. The fastest way is ToolsOfWeb’s free Base64 converter, which runs 100% in your browser — nothing is uploaded.
Base64 shows up everywhere in development: API tokens, JWT payloads, data URIs for embedded images, email attachments, and encoded blobs in logs. It exists for one reason — to represent binary data as plain ASCII text so it survives systems that only handle text (URLs, JSON, email, headers). This guide covers encoding, decoding, URL-safe mode, and file conversion, plus the mistakes that trip people up.
Try the tool
Open ToolsOfWeb’s Base64 Encode & Decode to convert text instantly, with URL-safe mode and file-to-Base64 built in.
How to encode text to Base64 (step-by-step)
- Open the Base64 converter and make sure “Encode → Base64” is selected.
- Type or paste your text into the input box — the result appears live.
- If the output goes into a URL or token, tick “URL-safe output”.
- Copy the result or download it as a .txt file.
Example: Hello, world! encodes to SGVsbG8sIHdvcmxkIQ==. Note the = padding at the end — that is normal and part of the format.
How to decode Base64 (step-by-step)
- Switch the converter to “Decode Base64 →”.
- Paste the Base64 string into the input box.
- The original text appears instantly. Data URIs (starting with
data:…;base64,) are handled automatically.
Decoding fails? The usual causes: a typo or a missing character, text that was never Base64 (hex strings look similar), or line breaks pasted from an email client. URL-safe strings with - and _ and no padding are also accepted.
URL-safe Base64, explained
Standard Base64 output can contain + and /, which have special meaning in URLs and would need percent-encoding. URL-safe mode replaces + with - and / with _, and strips the = padding. That is the variant JWTs use for their header and payload segments. If you are building tokens or stuffing values into query strings, always use URL-safe mode.
Convert a file or image to Base64
Use the “File → Base64” tab and drop in any file up to 25 MB. You get a full data URI such as data:image/png;base64,iVBORw0KGgo…, ready to paste into an <img> tag, a CSS url(), or a JSON field. Keep in mind that Base64 inflates data by about 33%, so it suits small assets (icons, tiny images) — not multi-megabyte photos.
Base64 vs encryption: the critical difference
This is the single most misunderstood thing about Base64: it provides zero secrecy. It is a transport encoding, like writing a message in Morse code — different representation, same information. If you need secrecy, encrypt first (for example with a proper library), then Base64-encode the ciphertext for transport if you must. Encoding a password in Base64 and storing it is barely better than plaintext.
UTF-8 and emoji: why some tools break
JavaScript’s raw btoa() only handles Latin-1 characters, so naive tools mangle emoji and non-English text (Urdu, Arabic, Chinese). A correct encoder converts the string to UTF-8 bytes first, then encodes those bytes. ToolsOfWeb’s converter does this, so 😀 and multilingual text round-trip correctly.
Helpful follow-up tools
- Pretty-print API responses before encoding with the JSON Formatter.
- Compare two encoded strings with the Text Diff Checker.
- Generate the secrets you encode with the Password Generator.
FAQs
How do I encode text to Base64?+
Paste your text into a Base64 encoder and it converts it instantly — for example, “Hello” becomes “SGVsbG8=”. ToolsOfWeb’s free converter does this in your browser with full UTF-8 support, so emoji and non-English text work too.
How do I decode a Base64 string?+
Paste the Base64 string into a decoder and switch to decode mode. The tool converts it back to readable text. If decoding fails, check for typos, missing padding (=), or text that was never Base64.
Is Base64 encoding secure or encrypted?+
No. Base64 is encoding, not encryption — anyone can decode it in seconds. It only makes binary data safe to transport as text. Never rely on it to hide passwords, tokens, or secrets.
What is URL-safe Base64?+
Standard Base64 uses + and /, which break URLs. URL-safe Base64 replaces them with - and _ and drops the = padding, so the output works directly in query strings, filenames, and JWT tokens.
How do I convert an image to Base64?+
Use a file-to-Base64 tool: drop in the image and you get a data URI like data:image/png;base64,iVBORw0KGgo… which you can paste straight into HTML, CSS, or JSON. ToolsOfWeb’s converter does this entirely in your browser.
Encode or decode Base64 now
Use Base64 Encode & Decode — free, private, and instant. Text, URL-safe mode, and file-to-Base64 in one place.
