Available inall 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 code examples. Examples apply VCL to real-world use cases and can be deployed as they are, or adapted for your own service. See the full list of code examples for more inspiration.

Click RUN on a sample below 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.