Tekno101
Guides

Choose URL encoding or Base64 for the right purpose

Encoding changes representation; neither operation encrypts the input.

Encode one URL component

The URL encoder uses encodeURIComponent. Use it for a query value or path segment, not an entire address: encoding a complete URL also encodes its structural punctuation.

The decoder uses decodeURIComponent. It requires valid percent escapes and UTF-8 bytes. A plus sign remains a plus sign; form-urlencoded decoding, where + means a space, is a different operation.

Input: café & tea
Encoded: caf%C3%A9%20%26%20tea

Base64 operates on UTF-8 bytes

Text is converted to UTF-8 bytes before Base64 encoding, so accented characters and emoji can round-trip correctly. Output uses the standard + and / alphabet with = padding.

Decoding accepts standard padded Base64, ignores whitespace and requires the decoded bytes to be valid UTF-8. It is a text decoder; binary image or archive content is not a supported text result.

Input: Hello
Base64: SGVsbG8=

Do not confuse encoding with secrecy

Anyone can decode Base64 or percent encoding. Do not use either as password protection, encryption or a substitute for access control. The result can expose the original data as plainly as the input.

Base64 normally increases byte length. It is useful when a protocol requires a text representation of bytes, not as a way to compress a file. URL-safe Base64 uses another alphabet and is not this decoder’s format.

Verify before integrating

Encode a short Unicode phrase, decode the generated output and compare it character for character. For URL input, test spaces, ampersands and a plus sign separately.

For an invalid input such as %ZZ or malformed Base64, expect an error without a success file. Check the receiving application’s expected encoding before using the generated text.

Open tool