A slug is the readable last part of a web address that names one specific page, like diwali-sweets-box in example.in/products/diwali-sweets-box. A slug generator is any tool, plugin or CMS feature that turns a page title into that slug automatically: lowercase letters, words joined by hyphens, punctuation removed. You can also write good slugs by hand in under a minute, and this guide shows you exactly how.
What is a slug in a website?
The word comes from newspaper publishing, where editors gave each story a short working label. Two pages on the same site cannot share the same slug at the same level, because the server would not know which one to show.
Good slugs are short, descriptive and stable. A visitor who sees /services/gst-registration-nagpur on WhatsApp knows what the page is about before tapping it. A visitor who sees /index.php?id=4471&cat=9 has no idea.
Where the slug sits in a URL
MDN's guide to the anatomy of a URL breaks every address into a scheme, an authority (domain and optional port), a path, optional parameters and an optional anchor. The slug is the final piece of the path. Here is a typical Indian store URL broken down:
| Part | Example | What it does |
|---|---|---|
| Scheme | https:// | Tells the browser which protocol to use |
| Domain | www.example.in | Identifies the web server |
| Path (folder) | /collections/ | Groups related pages; often set by the platform |
| Slug | cotton-sarees | Names this one page; you choose it |
| Parameters | ?sort=price-low | Optional settings such as sorting or tracking |
| Anchor | #size-guide | Jumps to a section of the page; never sent to the server |
Put together: https://www.example.in/collections/cotton-sarees?sort=price-low#size-guide. Only cotton-sarees is the slug.
Slug, URL, permalink and handle: same idea, different names
- URL: the full address, from
https://to the end. - Slug: the page-naming segment at the end of the path.
- Permalink: WordPress's term for the full, permanent URL of a post or page, which includes the slug.
- Handle: Shopify's term for the slug of a product, collection, page or blog post.
Why slugs matter for SEO and for people
A slug is a small on-page signal, not a ranking shortcut. Changing /p?id=12 to /kids-school-shoes will not lift a weak page to the top of Google on its own. What it does is make the page easier to understand for searchers, for people you share links with, and for Google, which recommends readable words over long ID numbers.
Slugs also appear in WhatsApp link previews, analytics reports and the links other sites use to cite you, so a clean one is easier to remember and trust. For the rest of your page basics, see our on-page vs off-page SEO checklist.
Rules for SEO-friendly slugs, based on Google's guidelines
Google Search Central publishes URL structure best practices. Most slug advice you will read online traces back to these points:
- Use readable words, not IDs. Google prefers descriptive words such as
/wiki/Aviationover a long string of numbers and letters. - Use hyphens, not underscores. Google recommends hyphens to separate words. Underscores are commonly used inside programming names, and words jammed together (like
greendress) are also discouraged. - Use your audience's language. Google says to use words your audience searches in, and that transliterated words are fine where they apply.
- Pick one letter case. URLs are case sensitive, so
/Sareesand/sareesare different URLs to Google. Lowercase everywhere avoids duplicates. - Drop parameters that do not change content. Session IDs, referral codes and sort orders belong in cookies or analytics, not in the URL you want indexed.
- Do not rely on fragments. Google generally does not support content that only appears after a
#.
Two practical habits on top: keep slugs to roughly three to six words, and leave out dates unless the content is truly dated.
| Weak slug | Better slug | Why |
|---|---|---|
/Product_Page_1023 | /steel-water-bottle-1-litre | Words instead of an ID, hyphens, lowercase |
/the-10-best-and-most-affordable-cafes-in-nagpur-for-2024 | /best-cafes-nagpur | Shorter, no date, keeps the meaning |
/services?id=7&ref=fb | /services/website-maintenance | No parameters, describes the page |
/greendress | /green-dress | Separated words are easier to read |
How to create a slug by hand: a step-by-step method
Every slug generator follows roughly the same algorithm. Doing it yourself once makes it easy to spot when a tool gets it wrong. Start with your page title and work through these steps:
- Start from the main idea, not the full headline. "Top 7 Reasons Why Every Clinic in Pune Needs Online Booking in 2026" is a headline. The idea is "clinic online booking".
- Convert to lowercase. "Clinic Online Booking" becomes "clinic online booking".
- Transliterate non-English words into Latin letters (see the section on Hindi titles below).
- Remove punctuation and symbols. Drop apostrophes, question marks, commas, colons and emojis. Replace
&with "and" or remove it. Write "₹999" as "999" or "under-999". - Remove stop words carefully. Cut "a", "an", "the", "of", "for" and similar words only when the meaning survives.
- Replace spaces with single hyphens. "clinic online booking" becomes
clinic-online-booking. - Clean up the edges. Collapse double hyphens into one and remove any hyphen at the start or end.
- Check it is unique. Make sure no other page on the site already uses it. If one does, choose a more specific slug rather than adding
-2.
Removing stop words carefully
Stop word removal is where automatic tools most often go wrong. Some words look small but carry the meaning. "How to" matters in /how-to-file-gst-return because people search that way. "Not" changes the meaning completely in /why-is-my-site-not-showing-on-google. And "in" can be part of a phrase people actually type, like "what is slug in website".
The rule of thumb: read the slug aloud. If it still sounds like what a customer would search for, it is good. If it reads like a telegram, put a word back.
Hindi and Marathi titles: transliterate, do not paste Devanagari
If your page title is "दिवाली ऑफर", you have two choices. You can paste the Devanagari into the slug, which browsers display fine in the address bar but which gets percent-encoded when copied. Google's guidelines note that non-ASCII characters should be percent-encoded in links, so the same slug shared on WhatsApp or email turns into a long string like %E0%A4%A6%E0%A4%BF... that nobody can read.
The cleaner choice for most Indian businesses is to transliterate: diwali-offer. Google explicitly says transliterated words are fine when that is how your audience searches, and most Indians type Hindi queries in Roman script anyway. Some examples:
- "अपनी वेबसाइट कैसे बनाएं" becomes
apni-website-kaise-banaye(that is the exact slug we used for our Hindi guide to building a website). - "पुणे में सबसे अच्छा डेंटिस्ट" becomes
best-dentist-puneorpune-mein-best-dentist, depending on how your customers search. - "गणपति सजावट सामान" becomes
ganpati-decoration-items.
Pick one transliteration style and stick with it, rather than mixing kaise and kese across pages.
What a slug generator does, and when you need one
A slug generator automates steps 2 to 7 above. You paste or type a title, and it lowercases the text, strips punctuation, swaps spaces for hyphens and trims stray characters. Better ones also handle accented letters and offer optional stop word removal. Free online tools do this, and so does nearly every modern website platform, the moment you save a page.
What a generator cannot do is judgement. It does not know that your customers search "chappals" rather than "sandals", or that a 12-word headline should become a 3-word slug. Treat its output as a first draft.
WordPress: permalinks set the slug for you
WordPress builds every post URL from a permalink structure. Its documentation on customising permalinks explains that the default "Plain" setting produces URLs like example.com/?p=123, which it describes as neither user friendly nor search optimised. Switching to the "Post name" structure under Settings, Permalinks gives you pretty URLs instead.
With that structure, WordPress generates a sanitised slug from your title. Its own example turns "This Is A Great Post!" into this-is-a-great-post. You can edit the slug in the post editor before publishing, and you should: WordPress keeps every word, including the ones you would cut by hand. Set the permalink structure once, on day one, because changing it later changes every URL on the site.
Shopify: handles are generated once and never updated
Shopify calls slugs "handles". According to Shopify's developer documentation on handles, a handle is generated from the resource title, is always lowercase, and turns spaces and special characters into hyphens. If two products share a title, Shopify adds a number, so the second "Potion" becomes potion-1.
Two things catch store owners out. First, changing a product title later does not update its handle, so a product renamed from "Kurta Set Blue" to "Indigo Cotton Kurta Set" keeps its old URL until you edit the handle yourself. Second, Shopify fixes the folder part of the path: products live under /products/ and collections under /collections/, and you cannot remove those prefixes. Only the handle is yours to shape. Our guide to ecommerce SEO strategies for Shopify and WooCommerce goes deeper on product URLs, and if you want a store set up properly from the start, see our Shopify development service.
Custom-built sites: write the rule once in code
On a custom site built with Next.js, Laravel or Django, your developer writes the slug function using the same algorithm. The important extras are a uniqueness check against the database and a rule that the slug does not change automatically when the title is edited. A website development team should also give editors a field to override the generated slug.
Changing a slug safely with 301 redirects
Every time you change a slug, the old URL stops working unless you redirect it. Bookmarks, WhatsApp forwards and backlinks from other sites will all hit a 404 page.
Google's documentation on redirects and Google Search explains that permanent redirects (HTTP 301 or 308) tell Google to show the new URL in results and act as a strong signal about which URL is the preferred one. Temporary redirects (302, 307) keep the old URL in results. Google prefers server-side permanent redirects, and treats JavaScript redirects as a last resort because they may never be seen if rendering fails.
Follow this sequence whenever you rename a page:
- Ask whether the change is worth it. An imperfect slug that already ranks and has backlinks is usually better left alone.
- Note the old URL exactly, then change the slug in your CMS.
- Add a 301 redirect from the old URL to the new one. In Shopify, URL redirects only work from URLs that now return a 404, and you use a relative path such as
/collections/shirtsfor destinations on your own domain. On WordPress, a redirect plugin or your host's server rules can handle it. - Update your internal links to point straight at the new URL so visitors and Google do not pass through the redirect every time.
- Test the old URL in a private window. It should reach the new page in one hop, not a chain.
- Update your sitemap, request indexing in Search Console, and keep the redirect live, since old links elsewhere never disappear.
If a page has gone missing from Google after a URL change, our guide on why a site is not showing on Google walks through the usual causes, including broken redirects.
Difference between relative and absolute hyperlinks
There are two ways to write the href of a link, and the choice matters when you move domains or use staging sites.
Absolute hyperlinks
An absolute URL contains everything needed to find the page: scheme, domain and path. MDN's explanation of absolute vs relative URLs notes that this is what you must use in a browser's address bar, because there is no surrounding page to fill in the gaps. Example:
<a href="https://www.example.in/collections/cotton-sarees">cotton sarees</a>
Relative hyperlinks
A relative URL leaves out some parts and lets the browser fill them in from the current page. MDN describes several forms. Assuming the current page is https://www.example.in/collections/cotton-sarees:
| Type | href | Resolves to |
|---|---|---|
| Root-relative | /collections/silk-sarees | https://www.example.in/collections/silk-sarees |
| Document-relative | silk-sarees | https://www.example.in/collections/silk-sarees |
| Parent-relative | ../pages/contact | https://www.example.in/pages/contact |
| Anchor only | #size-guide | The same page, scrolled to the size guide |
Which one to use when
- Use root-relative links for pages on your own site. They survive a move from a staging domain to the live domain, or from
httptohttps, without a find-and-replace. Google's URL guidelines specifically warn that parent-relative links (the../kind) can produce endless broken paths for crawlers and recommend root-relative URLs instead. - Use absolute links for other websites. Linking to Google, a supplier or a news article always needs the full
https://address. - Use absolute URLs where there is no page context. Canonical tags, XML sitemaps, Open Graph tags for WhatsApp and Facebook previews, emails and newsletters, and links you paste into social media all need the full address.
- Avoid document-relative and parent-relative links in navigation and templates. They break the moment a page moves to a different folder depth.
A slug checklist before you hit publish
- Lowercase letters, numbers and hyphens only, three to six words.
- No dates, IDs, session codes or tracking parameters.
- Hindi or Marathi titles transliterated in one consistent style.
- Stop words removed only where the meaning survives.
- Unique on the site, and edited by a person even if a slug generator wrote the first draft.
- If it replaces an old URL: a 301 redirect is live and internal links are updated.
Planning a new site with clean URLs, redirects and internal linking built in from day one? Our web development service in Nagpur starts from ₹12,000 for up to 8 SEO-ready pages (all rates are on our pricing page), and for an existing site, the free AI and SEO audit on our SEO services page is a sensible first check.
Frequently asked questions
What is a slug in a website?
A slug is the part of a URL after the domain and folders that identifies a specific page, for example best-cafes-nagpur in example.in/blog/best-cafes-nagpur. It should be short, lowercase, hyphen-separated and describe the page so people and search engines understand it at a glance.
Is a slug generator good for SEO?
A slug generator saves time and applies the formatting rules correctly, but it copies every word of your title, including dates and filler. Use it for the first draft, then shorten the slug to the three to six words that match what customers search. The slug is a small signal; content and links matter far more.
Should I use hyphens or underscores in a URL slug?
Use hyphens. Google's URL structure guidelines recommend hyphens to separate words and advise against underscores and words run together. Hyphens are also what WordPress and Shopify use by default.
Can I change a slug after a page is published?
Yes, but the old URL will return a 404 unless you add a permanent 301 redirect to the new one. Update your internal links and sitemap as well. If the page already ranks and has backlinks, think twice before changing it at all.
What is the difference between relative and absolute hyperlinks?
An absolute hyperlink includes the full address, such as https://example.in/contact, so it works from anywhere. A relative hyperlink, such as /contact, relies on the current page to fill in the scheme and domain. Use root-relative links for pages on your own site and absolute links for other websites, emails, sitemaps and canonical tags.
How do I make a slug from a Hindi title?
Transliterate the main idea into Roman script, for example apni-website-kaise-banaye for a Hindi title about building a website. Devanagari slugs work in browsers but turn into long percent-encoded strings when copied into WhatsApp or email. Choose one spelling style and use it across the site.
Shubham N Datarkar
Founder, Timewheel
Shubham founds and leads Timewheel, a Nagpur product studio that builds its own software and runs SEO, AI-search and growth for businesses across India. He writes from hands-on work shipping products and measuring what actually moves rankings and revenue.
Comments
Be the first to comment.


