ENCODEURL Function

Makes text safe to put inside a web address.

Category

Web

Available in

Excel 2013+ for Windows, Microsoft 365 (not Mac or the web)

Returns

URL-encoded text

Want to practice ENCODEURL in a real spreadsheet? Open a blank sheet in our Practice Sandbox and try it with live data, with the AI Excel tutor beside you. No Excel needed — just a free account.Try it free in the Sandbox

Overview

Web addresses can't contain spaces, ampersands or many other characters. ENCODEURL replaces each of them with a % code — a space becomes %20, & becomes %26 — so the text can go into a URL.

Letters, digits and the characters - _ . ~ stay as they are. Use it when building links or WEBSERVICE requests from cell values.

Syntax

=ENCODEURL(text) Explain

Arguments

ArgumentRequired?What it does
textYesThe text to encode — usually one part of a URL, such as a search term.

Examples

Example 1 — Encode search terms

Spaces, ampersands and accented letters all become % codes.

B2fx=ENCODEURL(A2)
AB
1TextEncoded
2Q1 Sales.xlsxQ1%20Sales.xlsx
3Smith & SonsSmith%20%26%20Sons
4CaféCaf%C3%A9
5north-region_2026north-region_2026
=ENCODEURL(A2) Explain

Example 2 — A clickable map link for each customer

Encode only the address part, then join it onto the fixed start of the URL.

=HYPERLINK("https://www.google.com/maps/search/?api=1&query="&ENCODEURL(B2),"Map") Explain

Common mistakes

  • Encoding the whole URL. ENCODEURL("https://…") also encodes the : and / characters and breaks the link. Encode just the values you insert.

Notes

Kyle Stott

Author

Kyle Stott

Certified Microsoft Excel Expert

Kyle has worked professionally with Microsoft Excel for over a decade and has consulted on and taught Excel best practices to over 400 companies across 30+ countries.