The function URL_ENCODE escapes characters that have a special meaning in URLs.

This function takes a primitive (String, Number, or Boolean), and returns a string representation of the input with any special URL characters (such as '/', '=', etc...) replaced with the character's Percent Encoding. This function is useful when you need to display a URL to the user that contains data that the user entered.


URL_ENCODE(primitive) -> encoded_string


primitive (type: string | number | boolean)
The primitive to encode.

Return Values

encoded_string (type: string)
The URL encoded string.


For this example assume that a user has entered some text that is stored in a variable named search_query.

search_query = "date/time"

We would like to create a hyperlink to a google search for the search query the user provided. This is done by adding the search query to the url. Note, however, that the user's query contains a slash character, which has a special meaning in a URL. When creating the hyper link we must escape any such characters. Note how the slash character is converted into the characters "%2F". Each special character will have its own code.

"https://www.google.com/search?q={{URL_ENCODE(search_query)}}" ->  


The URL_DECODE function will perform the opposite operation, in other words, it will convert any URL percent encodings into the matching character.