HandyHex.Handy tools in every shape.
GUIDE · 3 MIN READ

How to Write Clean URLs and Slugs

Best practices for web address slugs: length, hyphens, lowercase, changing URLs safely, and how to encode special characters.

What a slug is

The slug is the readable part of a web address that identifies a page, for example how-compound-interest-works in example.com/guides/how-compound-interest-works. A good slug tells people and search engines what the page is about before it even loads, and looks trustworthy when pasted into a message.

Rules that work

Use lowercase letters, because some servers treat uppercase and lowercase as different addresses. Separate words with hyphens, not underscores or spaces; Google's guidance treats hyphens as word separators. Keep it short and descriptive, usually three to six words. Leave out filler words such as 'a', 'the' and 'and' when the meaning stays clear. Avoid dates unless the content is truly date-bound, avoid special characters, and never stuff keywords. The Slug Generator applies these rules: it lowercases, removes accents, and joins words with single hyphens.

Characters that need encoding

A URL may only contain a limited set of characters. A space, an ampersand, a question mark or a non-Latin letter inside a query value must be converted to percent codes: a space becomes %20 and & becomes %26. If you add a search term like cats & dogs to a link without encoding it, the ampersand will be read as the start of a new parameter. The URL Encoder / Decoder converts a value for you. Encode the pieces, not the whole address, or the slashes and colons will be encoded too.

Changing URLs without breaking things

A URL is a promise. Every link, bookmark and search result that points to it breaks if the address changes. If you must rename a page, set up a permanent (301) redirect from the old address to the new one, so visitors and search engines follow along and the page keeps its ranking signals. HandyHex does this on Vercel with a redirects list. It is much easier to choose a good slug at the start than to fix one later.

URLs on paper and in QR codes

Short, clean addresses are also easier to share offline. If you print a link on a poster or a business card, a QR code removes the need to type it at all. Create one with the QR Code Generator, use the full address including https://, test it with two different phones, and print it large enough with good contrast and a blank border. Remember that a QR code is fixed: if the page moves, the printed code points to the old address, which is another reason to keep URLs stable.

Structure your site's addresses

A tidy hierarchy helps visitors and search engines. /tools/word-counter and /guides/how-compound-interest-works say where you are. Keep a consistent pattern, use lowercase, and avoid deep nesting beyond three levels. Do not include file extensions or technical words like index in public addresses. Use hyphens, and avoid special characters, spaces and uppercase.

Duplicates, parameters and canonical tags

The same page reachable at several addresses, such as with and without a trailing slash, or with tracking parameters (?utm_source=...), can be treated as duplicates. Pick one version and tell search engines using a canonical link in the page head, and redirect the others with a 301. Our pages declare their canonical address, and Vercel redirects the .html versions to the clean ones.

Language, length and change

For non-English sites, many browsers display native-script URLs fine, but they are encoded when copied (for example %E0%B6...), so plain Latin slugs are easier to share. Keep total addresses under about 100 characters. When content changes, keep the slug unless it is wrong, and when you must change it, redirect from the old one permanently. Update your sitemap and internal links, and let search engines recrawl the new address.

Try the tools

Keep reading