FormulaCraft

How to create a URL slug from text in Excel and Google Sheets

Topic:Text manipulation
Excel & Google Sheets
=LOWER(SUBSTITUTE(TRIM(A2)," ","-"))

Verified example

Computed by a real spreadsheet engine on the sample data below.

Title
How to Use Excel
Top 10 Tips
Google Sheets Guide
Formula Basics

=LOWER(SUBSTITUTE(TRIM(A2)," ","-"))how-to-use-excel

Try it with your data

Edit the grid or formula, then run it through a real spreadsheet engine — no signup.

Sample data — click any cell to edit

Runs server-side · free · no signup

Step by step

  1. 1Start with TRIM(A2) to remove leading, trailing, and extra internal spaces.
  2. 2Apply SUBSTITUTE(…," ","-") to replace every space with a hyphen.
  3. 3Wrap with LOWER(…) to convert all characters to lowercase.
  4. 4Full formula: =LOWER(SUBSTITUTE(TRIM(A2)," ","-")).
  5. 5For a more thorough slug (removing special characters), chain additional SUBSTITUTE calls for each punctuation mark: commas, apostrophes, etc.

Tips

Need it for your exact data?

Describe your columns in plain English and get the precise formula for your sheet, with the right Excel or Sheets syntax.

Frequently asked

How do I remove special characters like apostrophes and commas?

Chain SUBSTITUTE calls: =LOWER(SUBSTITUTE(SUBSTITUTE(TRIM(A2),"'","")," ","-")) — add one SUBSTITUTE per character to remove.

Does this handle accented characters like é or ü?

No — accented characters pass through unchanged. You would need to replace each accented character with its ASCII equivalent using additional SUBSTITUTE calls or a macro.

More on Text manipulation

See all →

Formulas used

Written and reviewed by FormulaCraft Team. Each formula on this page is run through our verification engine before publishing.

Last reviewed: