Where to start First steps track · 15 stages
Linux Labs

Base64 and URL encoding

Base64, base64url and URL percent-encoding both ways, for any Unicode text.

Format
Direction
What to encode
Result

    

Type or paste text: the result updates as you type.

Calculated in your browser — nothing is sent to the server

Practice on a machine

Lab “The shop after a renewal”

medium ~25 min stage 5 of the “Web stack” track

Open the lab

In a Linux terminal

bash
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.

Loading…