Category: FUNCTION | Updated: 2026-11-22
How to Use the ENCODEURL Function in Google Sheets | URL-Encode Text (Percent-Encoding)
Syntax
=ENCODEURL(text)
- text: Specifies the text string (including non-ASCII characters, spaces, or special symbols) to URL-encode.
Practical Example with a Table
Here is an example of encoding search keywords and symbols with the ENCODEURL function for use as URL query parameters.
| Original Text | Formula | Encoded Result | Description |
|---|---|---|---|
Spreadsheet functions |
=ENCODEURL(A2) |
Spreadsheet%20functions |
Encoded in UTF-8 (spaces become %20) |
A&B=100% |
=ENCODEURL(A3) |
A%26B%3D100%25 |
Escapes symbols such as &, =, and % |
Google |
=ENCODEURL(A4) |
Google |
Standard alphanumeric characters remain unchanged |
Common Errors and Notes
- Do Not Pass the Entire URL to ENCODEURL: Passing a full URL like
https://example.com/?q=searchwill encode:,/, and?as well, breaking the link. Apply it only to the parameter value. - How Spaces Are Encoded: Spaces are converted to
%20, not+. - Numbers and Blank Cells: Passing a numeric cell automatically converts it to text before encoding, and passing a blank cell returns an empty string (
"").
Frequently Asked Questions
Q. When is the ENCODEURL function needed?
A. When building dynamic search URLs or API request URLs with functions like HYPERLINK or IMPORTDATA, spaces, symbols, or non-ASCII keywords can break the link. ENCODEURL converts them so the URL works reliably.
Q. Is there a built-in function in Google Sheets to decode URL-encoded text back to normal text?
A. Google Sheets does not have a built-in DECODEURL function, so you can decode it by combining REGEXREPLACE functions or by using `decodeURIComponent` in Google Apps Script (GAS).