Quick Navigation
ENCODEURL Function
Summary
The Excel ENCODEURL function converts a text string into a properly formatted URL-encoded string by replacing special characters with percent-encoded hexadecimal equivalents. This ensures URLs are safe for web transmission and API calls.
Syntax
ENCODEURL(text)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| text | String |
Yes | Required text string containing characters that need URL encoding for safe web transmission |
Using the ENCODEURL Function
ENCODEURL is crucial when building dynamic URLs for web services, APIs, or hyperlinks containing user input, spaces, or special characters. It transforms problematic characters into safe percent-encoded format.
Common ENCODEURL Examples
Basic URL Encoding
=ENCODEURL("http://contoso.sharepoint.com/Finance/Profit and Loss Statement.xlsx")
Converts spaces to %20 and slashes to %2F: http%3A%2F%2Fcontoso.sharepoint.com%2FFinance%2FProfit%20and%20Loss%20Statement.xlsx
Stock Quote API Call
=WEBSERVICE("http://dev.markitondemand.com/MODApis/Api/Quote/xml?symbol="&ENCODEURL(C2))
Safely encodes stock ticker from cell C2 for API request
Extract Stock Price
=FILTERXML(WEBSERVICE("http://dev.markitondemand.com/MODApis/Api/Quote/xml?symbol="&ENCODEURL(C2)),"//QuoteApiModel/Data/LastPrice")
Combines ENCODEURL with WEBSERVICE and FILTERXML to get real-time stock price
Frequently Asked Questions
Common Errors and Solutions
#NAME? error
Cause: ENCODEURL not available in Excel for Mac or Web
Solution: Use Windows version of Excel or substitute with SUBSTITUTE functions
Unexpected encoding results
Cause: Input already contains percent-encoded characters
Solution: Ensure input text is in plain format before encoding
Notes
- Alphanumeric characters (A-Z, a-z, 0-9) remain unchanged
- Only non-safe URL characters get percent-encoded
- Ideal companion for WEBSERVICE function
- May appear in Mac function gallery but won't work there
Compatibility
Available in: Excel 2013, Excel 2016, Excel 2019, Excel 2021, Excel for Windows, Microsoft 365 (Windows)
Not available in: Excel for Mac, Excel for the web, Excel 2010 and earlier
Content last reviewed: December 9, 2025
Update frequency: As needed
Excel versions tested: Excel 2013+, Excel for Windows