---
title: url_decode function
description: Learn the syntax of the url\_decode function of the SQL language in Databricks SQL and Databricks Runtime.
canonical_url: https://docs.databricks.com/aws/en/sql/language-manual/functions/url_decode
---

# `url_decode` function

**Applies to:** ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks SQL ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks Runtime 11.3 LTS and above

Translates a string back from [application/x-www-form-urlencoded](https://www.w3.org/TR/html4/interact/forms.html#h-17.13.4.1) format.

## Syntax

```
url_decode(str)
```

## Arguments

* `str`: A `STRING` expression to decode.

## Returns

A `STRING`.

If the string does not comply with the [application/x-www-form-urlencoded](https://www.w3.org/TR/html4/interact/forms.html#h-17.13.4.1) format, Databricks raises [CANNOT\_DECODE\_URL](https://docs.databricks.com/aws/en/error-messages/error-classes.md#cannot_decode_url).
To return `NULL` instead, use the [try\_url\_decode()](https://docs.databricks.com/aws/en/sql/language-manual/functions/try_url_decode.md) function.

## Common error conditions

* [CANNOT\_DECODE\_URL](https://docs.databricks.com/aws/en/error-messages/error-classes.md#cannot_decode_url)

## Examples

```sql
> SELECT url_encode('http://spark.apache.org/path?query=1');
 http%3A%2F%2Fspark.apache.org%2Fpath%3Fquery%3D1

> SELECT url_decode('http%3A%2F%2Fspark.apache.org%2Fpath%3Fquery%3D1');
 http://spark.apache.org/path?query=1

> SELECT url_decode('http%3A%2F%2spark.apache.org');
 Error: CANNOT_DECODE_URL

> SELECT try_url_decode('http%3A%2F%2spark.apache.org');
 NULL

> SELECT parse_url('http://spark.apache.org/path?query=1', 'QUERY', 'query');
 1

> SELECT parse_url('http%3A%2F%2Fspark.apache.org%2Fpath%3Fquery%3D1', 'QUERY', 'query');
 1
```

## Related functions

* [`parse_url` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/parse_url.md)
* [`try_url_decode` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/try_url_decode.md)
* [`url_encode` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/url_encode.md)
