ENCODEURL function

ENCODEURL converts a text string into a percent-encoded URL component, escaping characters that are illegal in web addresses.

=ENCODEURL(text)

Generate a ENCODEURL formula

Describe what you need. The generator will reach for ENCODEURL where ENCODEURL is the right tool, and tell you when it is not.

How to get a better answer
  • Name your columns by letter and by header: "column F (Net Value)" beats "the amount column".
  • State every condition, including the negatives — "not cancelled" changes the formula's shape.
  • Say where the data starts if it is not row 1, and whether it will grow.
  • Check the settings above match your spreadsheet: the wrong argument separator is a syntax error on your machine.

Arguments

How ENCODEURL reads its arguments
textrequiredENCODEURL
ArgumentRequiredDescription
textRequiredA required value of any type; Excel coerces it to text and encodes it, returning #VALUE! if omitted or if the text exceeds 32,767 characters.

Returns

A single text string containing the percent-encoded version of the input.

Availability

Excel: All · Google Sheets: Supported

Worked examples

1. Create a safe profile link for an employee

Employee IDNameDepartmentHire DateSalaryStatus
E001Alice JohnsonMarketing2015-06-0175000Active
=ENCODEURL("https://company.com/profile?empid=" & A2 & "&name=" & B2)

Result: https%3A%2F%2Fcompany.com%2Fprofile%3Fempid%3DE001%26name%3DAlice%20Johnson

The formula concatenates a base URL with the employee ID from A2 and the name from B2. ENCODEURL then percent-encodes the entire string, turning the colon, slashes, question mark, ampersand and space into their %XX equivalents, producing a URL that can be safely passed to a web service.

2. Encode a department-status query for a web service

Employee IDNameDepartmentHire DateSalaryStatus
E002Bob SmithEngineering2018-09-1588000Active
=ENCODEURL("dept=" & C3 & "&status=" & F3)

Result: dept%3DEngineering%26status%3DActive

C3 holds the department "Engineering" and F3 holds the status "Active". The concatenated query string "dept=Engineering&status=Active" is fed to ENCODEURL, which converts the equal signs and ampersand to %3D and %26 so the string can be appended to a URL without breaking its syntax.

3. Generate a URL-encoded email address for a staff member

Employee IDNameDepartmentHire DateSalaryStatus
E003Carol LeeHR2020-01-2062000On Leave
=ENCODEURL(LOWER(B4) & "." & A4 & "@company.com")

Result: carol%20lee.E003%40company.com

LOWER converts "Carol Lee" to "carol lee", then the formula builds the address "carol lee.E003@company.com". ENCODEURL changes the space to %20 and the @ symbol to %40, yielding a fully encoded email string that can be used in query parameters.

Common errors

Which ENCODEURL error are you seeing?
ENCODEURL returned an error#VALUE!
Supply a literal string or a cell reference containing the text to encode.
#VALUE!
Trim the source string, or split it into smaller parts and encode each separately.
#N/A
Wrap the lookup in IFERROR (or IFNA) to provide a fallback string before calling ENCODEURL.
ErrorWhy it happensHow to fix it
#VALUE!The required text argument is missing, e.g., =ENCODEURL().Supply a literal string or a cell reference containing the text to encode.
#VALUE!The input text exceeds the 32,767-character limit for ENCODEURL.Trim the source string, or split it into smaller parts and encode each separately.
#N/AThe argument evaluates to a lookup error, such as =ENCODEURL(VLOOKUP("Z",A2:A4,1,FALSE)).Wrap the lookup in IFERROR (or IFNA) to provide a fallback string before calling ENCODEURL.

Tips and when to use something else

  • Combine ENCODEURL with & or CONCAT to build full URLs; the function only encodes the string you give it.
  • Use HYPERLINK to turn the encoded result into a clickable link in the worksheet.
  • If you need to decode a percent-encoded string, ENCODEURL cannot do it; use a custom VBA function or Power Query instead.
  • When you only need to extract parts of a URL (e.g., the domain), consider TEXTAFTER/TEXTBEFORE or FILTERXML rather than ENCODEURL.

Frequently asked questions

Can ENCODEURL encode an entire range of cells at once?
No. ENCODEURL accepts a single text argument. To encode multiple cells you must first join them with TEXTJOIN, CONCAT, or a BYROW/LAMBDA construct, then pass the combined string to ENCODEURL.
Why does ENCODEURL replace spaces with %20 instead of plus signs (+)?
ENCODEURL follows the RFC 3986 standard for percent-encoding, which mandates %20 for spaces. The plus-sign convention belongs to the application/x-www-form-urlencoded content type, not to general URL encoding.
Is ENCODEURL available in Google Sheets?
Yes. Google Sheets implements ENCODEURL with the same syntax and behavior as Excel. The function will percent-encode the supplied text, turning spaces into %20 and escaping other reserved characters.
Which characters are left unchanged by ENCODEURL?
Unreserved characters—letters A-Z and a-z, digits 0-9, hyphen (-), underscore (_), period (.), and tilde (~)—are not encoded. All other characters, including spaces, punctuation, and non-ASCII symbols, are converted to %XX sequences.

Need a different formula?

The full generator is not scoped to one function — describe any spreadsheet problem and it will pick.

Open the formula generator

Reviewed 2026-09-17