Base64 and URL encoding
Base64, base64url and URL percent-encoding both ways, for any Unicode text.
Calculated in your browser — nothing is sent to the server
Practice on a machine
Lab “The shop after a renewal”
In a Linux terminal
echo -n 'Hello' | base64
# SGVsbG8=
echo 'SGVsbG8=' | base64 -d
# Hello
base64 -w0 file.bin > file.b64
# a file on one line
curl -G example.com --data-urlencode 'q=user & group'
# a percent-encoded parameter
Without -n, echo adds a line break and the Base64 comes out different.
Keep in mindBase64 is not encryption: anyone can decode the string, so hiding passwords in it is pointless.
Part or whole URL
Encode a parameter value as a “part”: / ? & = become %XX too. “Whole URL” keeps them and
encodes only spaces, non-Latin letters and quotes — that is how you fix a link. A space as + is
only for HTML form data.
FAQ
Is Base64 encryption?
No: it only writes bytes differently, and anyone can decode it. Secrets are encrypted (gpg,
openssl enc), and Base64 is applied to the result.
Why is the decoded text garbage?
The data inside is not UTF-8 text: an image, an archive, a key or text in another encoding. Decode
a binary file in the terminal: base64 -d data.b64 > file.bin.
What are the = signs at the end for?
Base64 encodes bytes in threes, and = pads an incomplete group to four characters. base64url
usually drops them.