ENCODEURL Function

Excel Functions › Web

Excel 2013+ Windows desktop only

The Excel ENCODEURL function percent-encodes text so it is safe to use inside a URL — spaces become %20, ampersands %26, and so on. It is the glue that makes WEBSERVICE calls and HYPERLINK query strings reliable.


Quick answer: make a search term URL-safe:
=ENCODEURL("Dallas Fort Worth & Houston") // returns Dallas%20Fort%20Worth%20%26%20Houston

Syntax

=ENCODEURL(text)
ArgumentDescription
textRequiredThe string to percent-encode.

How to use it

Building a query URL from cell values — encode each piece, not the whole URL:

="https://api.example.com/search?q=" & ENCODEURL(B2) & "&city=" & ENCODEURL(B3)

Encoding the entire URL would also encode the :// and ? separators and break it. Encode only the values.

Windows desktop only: the Web functions (ENCODEURL, FILTERXML, WEBSERVICE) are not available in Excel for the Web, Excel for Mac, or mobile — cells show #NAME? there. For cross-platform data pulls, use Power Query (Data → From Web) instead.

Try it: interactive demo

Live demo

Type any text and see exactly what ENCODEURL would return.

Result:

Errors & common pitfalls

Pitfall: encoding the whole URL. ENCODEURL is for query values. Run it on https://example.com?q=x and the slashes and question mark get encoded too, breaking the link.

Windows desktop only: the Web functions (ENCODEURL, FILTERXML, WEBSERVICE) are not available in Excel for the Web, Excel for Mac, or mobile — cells show #NAME? there. For cross-platform data pulls, use Power Query (Data → From Web) instead.

Power Query is usually the better tool. These functions predate Power Query; for refreshable, authenticated, multi-row web data, Data → Get Data → From Web wins on every axis. The Web functions remain handy for quick one-cell lookups.

Practice workbook

📊
Download the free ENCODEURL practice workbook
Every example on this page, ready to open in Excel — plus practice challenges with answers on a separate tab. No sign-up required.

Frequently asked questions

What characters does ENCODEURL change?
Everything that isn't an unreserved URL character (letters, digits, - _ . ~) becomes a %XX code: spaces %20, & %26, ? %3F, / %2F, plus accented and non-Latin characters as UTF-8 sequences.
Why does ENCODEURL show #NAME? on my Mac?
The Web functions are Windows-desktop only. On Mac or Excel for the web, build encodings with SUBSTITUTE chains or move the workflow to Power Query.
Is there a decode function?
No DECODEURL exists. Decoding needs SUBSTITUTE chains, Power Query, or VBA.
When do I actually need it?
Whenever cell text goes into a URL: WEBSERVICE API calls, HYPERLINK to search pages, mailto links with subjects — any value containing spaces or symbols.

Master functions like this in one day

This page covers one function. Our Excel Formulas and Functions class covers the 30 that matter most — live, hands-on, taught by professionals in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.

See the Formulas & Functions Class

Related functions: ENCODEURL · FILTERXML · WEBSERVICE · TEXTSPLIT · HYPERLINK