Base64url
- is a variant of the Base64 Notation standard where:
- where the ’
+’ and ’/’ characters of are respectively replaced by ’-’ and ’_’, so that using URL encoders/decoders is no longer necessary and has no impact on the length of the encoded value, leaving the same encoded form intact for use in relational databases, web forms, and object identifiers in general - allow or require omitting the padding ’
=’ signs to avoid them being confused with field separators, or require that any such padding be percent-encoded. Some libraries will encode ’=’ to ’.’, potentially exposing applications to relative path attacks when a folder name is encoded from user data.
- where the ’
Encoding
convert data-to-be-converted into base64url
echo "data-to-be-converted" | base64 | sed 's/+/-/g; s/\//_/g'
ZGF0YS10by1iZS1jb252ZXJ0ZWQK