Developer Guide
Base64 vs URL Encoding
Base64 turns bytes into ASCII. Percent-encoding makes a value legal in a URL. They look similar and solve different jobs — with examples from the browser tools.
Both encodings emit printable ASCII, which is why they get swapped in code reviews. Base64 is a binary-to-text alphabet: any byte sequence becomes A–Z, a–z, 0–9, +, /, and =. Percent-encoding (URL encoding) is a quoting rule for URLs: a character that would break the address is replaced with % plus two hex digits.
Use Base64 when the data is bytes in a text channel. Use URL encoding when the data is already text inside a URL. Encoding a search term as Base64 wastes space and still leaves + and / unsafe in a query.
What Base64 is actually doing
Base64 groups input in threes of bytes and writes four characters. The payload grows by about 33%. Padding = fills the last group when the length is not a multiple of three. /tools/base64 encodes Unicode text this way: hello becomes aGVsbG8=.
That string is safe in JSON, email, and a data: URI. It is not a secret. Anyone who can read aGVsbG8= can decode it. Standard Base64 is also not URL-safe: +, /, and = are reserved or awkward in queries. The tool’s URL-safe mode uses - and _ and drops padding — only when the receiver expects Base64url (JWTs, some query tokens).
What percent-encoding is actually doing
A URL has syntax (?, &, =, #) and data (the search box). Percent-encoding protects the data. A space becomes %20. hello world on /tools/url-encoder in encodeURIComponent mode is hello%20world.
encodeURIComponent is for one value. encodeURI leaves : / ? # and friends alone so a whole address stays structured — which means it will not encode an & inside a parameter. HTML forms may turn spaces into + instead of %20. If a plus sign is data (C++), encode it as %2B before a form decoder sees it.
Size, alphabet, and reversibility
Base64 always expands. Percent-encoding only expands the characters that need it; hello is unchanged in a query, while hello world picks up three extra characters for the space. Both mappings are reversible. Neither is a hash: the original bytes come back exactly.
The alphabets overlap on letters and digits and then diverge. If you see a long block of mixed case with trailing =, you are looking at Base64. If you see %20, %26, or %2F, you are looking at a URL.
When you need both
A data URI is Base64 inside a URL: data:image/png;base64,iVBOR…. Browsers parse that as a data URL, so the + and / in the payload are fine after the comma. The same payload as ?img= is a query value: percent-encode it, or switch to Base64url first.
The correct stack is Base64 (or Base64url) first, then encodeURIComponent if the string becomes a query parameter. Encoding twice with encodeURIComponent turns %20 into %2520 and is a bug, not a second layer of safety.
A practical rule
Bytes, files, and JSON fields that must stay text → /tools/base64. A string going into a query, path, or form field → /tools/url-encoder with encodeURIComponent on the value, not the whole URL.
If you are unsure, encode the same sample in both tools. One result looks like aGVsbG8=. The other looks like hello%20world. Pick the job that matches.
Common pitfalls
Dropping raw Base64 into a query is the usual breakage: + becomes a space in form decoders and / can be read as a path separator depending on the stack. Using encodeURI on a concatenated ?q= + userInput leaves & intact, so the user injects extra parameters.
Base64 of a URL is not percent-encoding. Percent-encoding of a file is not a data URI. Decode on the same tool you used to inspect the alphabet.
hello→aGVsbG8=on/tools/base64.hello world→hello%20worldon/tools/url-encoder.- URL-safe Base64 is a different alphabet from percent-encoding.
Worked examples
Same word, two encodings
helloBase64: aGVsbG8= · percent-encoding: helloPercent-encoding leaves unreserved characters alone. Base64 always rewrites the bytes. Encode both on /tools/base64 and /tools/url-encoder.
A space in a query value
hello worldhello%20worldencodeURIComponent on /tools/url-encoder. Do not Base64 this search term; aGVsbG8gd29ybGQ= is a different string and still needs quoting if it later sits in a URL.
Frequently asked questions
Can I percent-encode instead of Base64 for a JSON file field?
JSON already allows Unicode strings. You need Base64 when the field is binary, not when it is text. Percent-encoding is for URLs, not JSON objects.
Why did my Base64 break in a query string?
+, /, and = are awkward in URLs. Use URL-safe mode on /tools/base64, or run encodeURIComponent on the standard Base64 string.
Is encodeURI good enough for query values?
No. encodeURI keeps & and =. Encode each value with encodeURIComponent on /tools/url-encoder, then join with &.
Does either encoding encrypt the data?
No. Both are reversible without a key. Transport secrecy is TLS.
Do these tools upload the string?
No. /tools/base64 and /tools/url-encoder run in the browser. There is no encoding API on thedevtools.in.
Summary
Base64 is for bytes in a text document. Percent-encoding is for values in a URL. Confirm hello → aGVsbG8= on /tools/base64 and hello world → hello%20world on /tools/url-encoder, and only stack them when a Base64 blob has to travel as a query parameter.