Web
ENCODEURL Function in Excel
Returns a URL-encoded string, replacing special characters with percent-encoded equivalents.
Syntax
- =ENCODEURL(text)
Arguments
- text (required): Text to URL-encode
Examples
- =ENCODEURL("Hello World") - Encode spaces - Result: Hello%20World
Microsoft Excel ENCODEURL function overview
- ENCODEURL is a Web function in Microsoft 365 and Excel 2021+ that percent-encodes text for safe use inside URLs and query strings.
- Syntax: =ENCODEURL(text). The text argument can be a literal string, cell reference, or formula result.
- Spaces become %20, ampersands %26, equals %3D, question marks %3F — letters, digits, and -_.~ stay unchanged.
- Pair with [WEBSERVICE](/functions/webservice/) for GET requests or Power Query when POST, headers, or JSON parsing are required.
When ENCODEURL is required
- Search terms and names in API query strings — raw spaces and symbols break URL parsing without encoding.
- Email addresses, file paths, and product titles passed as ?q= or &name= parameters.
- Concatenating user-entered values into WEBSERVICE URLs so Excel does not send malformed requests.
- Building deep links from spreadsheet-driven dashboards where each row supplies a different encoded parameter.
Build a URL with ENCODEURL
- Simple search: ="https://api.example.com/search?q="&ENCODEURL(A2) where A2 holds the user search phrase.
- Multiple params: =BASE&"?city="&ENCODEURL(B2)&"&state="&ENCODEURL(C2) with BASE stored in a named cell.
- Encode then append: ="https://maps.example.com/place/"&ENCODEURL(D2&", "&E2) for combined address strings.
- Test in browser: copy the formula result to the address bar — if it loads, encoding is correct for that API.
ENCODEURL character reference
- Space → %20 | ! → %21 | # → %23 | $ → %24 | & → %26 | + → %2B | , → %2C | / → %2F
- = → %3D | ? → %3F | @ → %40 | [ → %5B | ] → %5D | { → %7B | } → %7D | | → %7C
- Non-ASCII Unicode (accents, CJK) encode as UTF-8 percent sequences — ENCODEURL handles this automatically.
- There is no native DECODEURL; use SUBSTITUTE chains or Power Query for reverse decoding in bulk.
ENCODEURL with WEBSERVICE and Power Query
- WEBSERVICE pattern: =WEBSERVICE("https://httpbin.org/get?term="&ENCODEURL(A2)) — verify tenant allows external data.
- WEBSERVICE is GET-only, no custom headers, ~32KB response cap — use Power Query for OAuth or POST APIs.
- Power Query alternative: From Web connector encodes parameters in the UI; refresh on schedule for live dashboards.
- Security: never embed secrets in plain URLs; use approved API keys via secure connectors, not shared workbooks.
People also ask
- Is ENCODEURL in all Excel versions? — Microsoft 365 and Excel 2021+; not in Excel 2019 or Excel on the web in all tenants.
- What does ENCODEURL encode? — Characters that are reserved or unsafe in URLs; alphanumerics and -_.~ pass through.
- How do I encode a full URL? — Encode only the dynamic parameter values, not the entire https:// structure.
- ENCODEURL vs JavaScript encodeURIComponent? — Similar purpose; ENCODEURL follows URI encoding rules inside Excel formulas.
Common errors
- Returns text as-is if no encoding needed
Use cases
- URL building
- API calls
- Web queries
Frequently asked questions
- What characters does ENCODEURL encode? ENCODEURL encodes special characters that aren't allowed in URLs: spaces become %20, & becomes %26, = becomes %3D, ? becomes %3F, etc. Letters, numbers, and -_.~ are not encoded.
- How do I build a URL with query parameters? Concatenate the base URL with encoded parameters: ="https://api.example.com/search?q="&ENCODEURL(A1)&"&limit="&B1. This safely encodes the search term while keeping the URL structure intact.
- Is there a DECODEURL function? No, Excel doesn't have a built-in DECODEURL. To decode, use SUBSTITUTE to replace common codes: =SUBSTITUTE(SUBSTITUTE(A1, "%20", " "), "%26", "&"). For full decoding, use Power Query or VBA.
Editorial review
- Reviewed by Excel.Directory Editorial Team. Updated May 2026.
When to use ENCODEURL
- URL building — common Web scenario for ENCODEURL.
- API calls — common Web scenario for ENCODEURL.
- Web queries — common Web scenario for ENCODEURL.
ENCODEURL in the Web category
- Browse all Web functions at /categories/web/ for related formulas.
- ENCODEURL syntax: =ENCODEURL(text)
- text (required): Text to URL-encode
- Confirm ENCODEURL arguments match the syntax shown above before filling down.
- Lock table and range references with $ when copying formulas across rows or sheets.
Formula checklist before you copy down
- Confirm ENCODEURL arguments match the syntax shown above before filling down.
- Lock table and range references with $ when copying formulas across rows or sheets.
- If results look wrong, check for text stored as numbers and invisible spaces with TRIM.
- Spot-check three known input rows manually against expected output.
Related Excel functions
- WEBSERVICE (/functions/webservice/): Returns data from a web service on the internet or intranet.
- FILTERXML (/functions/filterxml/): Returns specific data from XML content using the specified XPath.
Errors to watch for
- Returns text as-is if no encoding needed — review causes on linked error pages in the directory.
Copy-paste audit workflow
- Enter ENCODEURL on three test rows with known expected output documented on a QA tab.
- Fill down only after absolute references are locked on lookup tables and rate tables.
- Compare against manual calculation or a calculator for financial and statistical functions.
- Search this directory for comparison guides when choosing between similar functions in the same category.
ENCODEURL worked examples to copy
- =ENCODEURL("Hello World") — Encode spaces. Expected result: Hello%20World.
ENCODEURL reference summary for crawlers and offline review
- ENCODEURL belongs to the Web category in Excel. Returns a URL-encoded string, replacing special characters with percent-encoded equivalents.
- Full syntax: =ENCODEURL(text). Open /functions/encodeurl/ for parameters, FAQs, and related pages.
- Common mistakes: Returns text as-is if no encoding needed
- Pair this function with comparison guides when another Excel formula might fit the same task better.
- Review fix-excel-formula-errors when unexpected errors appear after upgrading Excel or sharing across locales.