---
title: urldecode
summary: null
url: https://www.fastly.com/documentation/reference/vcl/functions/strings/urldecode
---


Decodes a percent-encoded string. For example, `urldecode({"hello%20world+!"});` 
and `urldecode("hello%2520world+!");` will both return `"hello world !"`.

> **IMPORTANT:** 
Although the input string may contain any percent-encoded data, the resulting output
is treated as a string.
As such, any *NUL* characters in the string will appear as a truncated result.


This function is not prefixed with the `std.` namespace.

## Example

```vcl
set req.http.X-Cookie = regsub(req.url, ".*\?cookie=", "");
set req.http.Cookie = urldecode(req.http.X-Cookie);
```
