Why URLs and form fields cause problems
In application/x-www-form-urlencoded data, a + character can be interpreted as a space. A / character can also conflict with a path separator when embedded in a URL path. Base64URL avoids these two characters. It does not replace proper URL construction: use URLSearchParams or an appropriate URL API instead of concatenating unescaped values. If a + was already replaced with a space, a decoder cannot reliably reconstruct the missing data.
How to convert between the formats
To create unpadded Base64URL, first encode the original bytes as Base64, replace + with - and / with _, then remove only trailing = characters if the target protocol allows it. For decoding, normalize the alphabet and add the required trailing padding. Do not remove internal characters or assume every service accepts both forms. Decodex encodes standard padded Base64; it accepts Base64URL on the decoding page.
JWT segments are not proof that a token is safe
The header and payload of a signed JWT commonly use unpadded Base64URL. Decoding a segment can show its text, but it does not verify a signature, expiry or permissions. The signature segment is binary and should not be expected to decode as UTF-8. This page does not validate JWTs; never share a real access token just to test decoding.
Verified experiments
| Input / operation | Expected result | Browser result |
|---|---|---|
?v=8J+YgA== | 8J YgA== | Not run |
URLSearchParams.set("v", "8J+YgA==") | 8J+YgA== | Not run |
8J-YgA | 😀 | Not run |
SGVsbG8%3D | Hello | Not run |
What the results mean
Parsing a raw query converts + into a space. Setting the value with URLSearchParams preserves it across serialization. Base64URL avoids +, but does not replace URL construction or restore data already lost.
How to reproduce
Run the checks and compare raw-query with safe-query. In the browser console inspect new URLSearchParams("v=8J+YgA==").get("v"). Rebuild the URL from the original value using set(), rather than replacing every space with +.
const p = new URLSearchParams();
p.set("v", "8J+YgA==");
console.log(p.toString()); // v=8J%2BYgA%3D%3D
console.log(new URLSearchParams(p.toString()).get("v")); // 8J+YgA==Verification method
These fixed, public fixtures run against the same file codec and character codecs used by the converter. The JavaScript cases additionally check browser-native btoa, TextEncoder, URLSearchParams and SHA-256. Expected outputs are published before any script runs; the button shows actual results in your browser. No input is uploaded.
JavaScript · guide-cases.js · JavaScript · file-codec.js
Scope and limitations
Checked on 2026-10-21. This is a correctness check with small fixtures and one 100,000-character case, not a speed benchmark or a guarantee for every file. The four-byte file is synthetic binary data, not a PNG or PDF. SHA-256 equality checks byte preservation; it does not establish that a file is safe to open. Results can depend on browser support.
References
Choose a guide for your problem
How to fix Base64 decoding errors
Diagnose which layer failed: Base64 syntax, text interpretation, or file restoration. This page is the diagnostic starting point; the other guides explain each layer in depth.
Base64 encoding Korean text and emoji with UTF-8
Compare identical text encoded as different bytes. Select a character encoding from knowledge of the source, not from the language of the website.
Base64 padding explained: what = and == mean
Work out padding from byte groups and check malformed endings. Character encoding and URL transport are covered separately.
JavaScript Base64 with Unicode: fix btoa() errors using UTF-8
Implement Unicode conversion in JavaScript and inspect cases where a successful btoa call still gives the wrong byte encoding.