Practice free

ENCODEURL function

ENCODEURL replaces spaces and unsafe characters in text with percent codes so it is safe to use in a web address. It works in Windows Excel only and is meant for the value part of a URL.

Example

Read it as a sentence: turn the text a b&c into a form that is safe to put in a web address, which gives a%20b%26c.

Practice this in the app

Syntax

ENCODEURL(text)

text (required)
The text to make safe for use in a web address.

Returns: The text with unsafe characters replaced by percent codes.

What Excel actually returns

Each formula below was run in desktop Excel. The result is exactly what the cell showed, errors included.

FormulaExcel showsCase
=ENCODEURL("a b&c=d/e?f") a%20b%26c%3Dd%2Fe%3Ff Spaces and symbols
=ENCODEURL("AZaz09-_.~") AZaz09-_.%7E Unreserved chars kept
=ENCODEURL("café ü") caf%C3%A9%20%C3%BC Unicode
=ENCODEURL("100%") 100%25 Percent sign
=ENCODEURL("1+1") 1%2B1 Plus sign
=ENCODEURL(12.5) 12.5 Number
=LEN(ENCODEURL(REPT("a",32767))) #VALUE! Long input 32767 chars
=ENCODEURL(REPT(" ",11000)) #VALUE! Expansion past 32767

Watch out for

  • Encode only the value part of a URL, not the whole address, or you will break the slashes and ?.
  • Spaces become %20, not +.

Where it works

Excel
ENCODEURL arrived in Excel 2013. Older versions do not have it. Windows only; not in Excel for Mac.
Google Sheets
Same name, same behaviour for everyday use. Same name and behaviour.

Part of Web functions. Every result on this page was measured in desktop Excel, build 16.0.20527. Last updated .