Available in all subroutines.

Returns the original representation of the base64url-encoded string s as produced by digest.base64url.

Although the input string may contain encoded binary data, the resulting output is treated as a string. As such, any NUL characters in the string will appear as a truncated result.

Padding is optional, and may be omitted. Decoding stops at the first instance of a = character, and any subsequent data is ignored. This is the only difference to the digest.base64url_nopad_decode function.

See digest.base64_decode for handling invalid characters and the behavior of padding.


declare local var.base64url_decoded STRING;
set var.base64url_decoded = digest.base64url_decode("zprOsc67z47PgiDOv8-Bzq_Pg86xz4TOtQ==");
# var.base64url_decoded is now "Καλώς ορίσατε"

Try it out

digest.base64url_decode is used in the following solution recipes, which show real world use cases. Click RUN to provision a Fastly service, execute the code on Fastly, and see how the function behaves.

Base64 URL path segments

Unknown data in URL paths can result in invalid URLs, but base64url is designed to be URL-safe.

User contributed notes

We welcome comments that add use cases, ideas, tips, and caveats. All comments will be moderated before publication. To post support questions, visit our support center and we'll find you the help you need.