What is a slug in URL?
Published Date: September 9, 2022
Updated Date: September 9, 2022
URL stands for Uniform Resource Locator
When we access anything on our web browser over the internet, we use an address or URL (Uniform Resource Locator).
A URL is a unique address (an identifier) that can help you locate a resource on the internet. You can read more about a URL
Slug is the URL portion that will help identify a website's exact page (resource) in a human-readable format. The slug is equally important to search engines as well as humans. Slug gives information on what the web page's content will bring for the user. People use a slug in their URL to provide their reader the context of the resource available at the URL v/s using an identifier like product Id.
Every page on your website or application needs to have a unique slug.
For example, if you check the address bar in your browser, it should show you the URL, something like this
If you see it carefully, a URL consists of various parts. In the above example,
blog/url/what-is-a-slug-in-url is the slug.
We can further break down the slug into two parts.
- Category or logical grouping of the resource/page. In our case, it is
/blogfollowed by the category
/urlfor our domain
- The slug for the page. In our example, it is
what-is-a-slug-in-url. This string will uniquely identify this particular page on the internet.
One of the reasons slug is such an essential aspect of a URL is that when you share the URL with someone, all they see is the domain and the slug. Suppose we make our slug human-readable and user-friendly. The link will get more confident clicks. A person who sees the URL can feel more aware in clicking the link v/s a link such as
When you work on your websites, create a slug that gives the user enough information on where the URL will lead them.
If it is a news article, it should summarize what that article is about (in a few words). If the URL is going to be a KETO recipe, it should make it clear that on clicking the URL, the user will be able to see a KETO recipe.
In most cases, when we create the page, we always give it a title. If you make your title the slug, it usually works out. For example, our current webpage. The title is
What is a Slug in URL? and our slug becomes
Occasionally you do not want to include words like
too, etc. These words help you formulate your sentence but don't give much information about the webpage. A slug without the fillers or stop words is also very acceptable.
There is a possibility of including special characters in a title, but we usually remove any special characters from the url slug. If we do not remove it, we may need to encode our URL. You can also use an encoder to encode your URL.
As a good practice, we usually do not include numbers in a slug. It makes them less readable. However, when you have an article titled
13 Best practices for... having the number
13 will tell the user how many best practices you will get when you click that link. So, creating a slug is contextual. Again, this is just a thought, and there are better practices that we have learned on how you can write a slug for better SEO.
The most important reason for having a good slug is that slug adds value and context to humans and automated bots or search engine crawlers. These crawlers will try to get the most out of the URL and understand what that resource contains. This context will help the crawlers to queue up your page on the internet higher when the intent of a user search matches the content of your resource.
Frequently asked questions about the URL slug.
How to write a URL slug?
To write a creative slug that leaves an impression for your URL to stand out. We have covered the best practices for writing a URL slug. Your URL slug should follow the below rules.
What is an example of a slug?
A slug is the unique case-sensitive portion of a URL (Unified Resource Locator). A slug identifies the unique resource on the webpage (your domain). For example, if you have a page at
www.yourdomain.com/about for your About page. The
/about part of the URL is your slug. If you have directories on your website, then the last portion of your URL is the slug, for example,
toolsconverters.xyz/blog/url/what-is-a-slug-in-url the slug is
/url are treated as directories.
Why are slugs important?
Slugs are essential for multiple reasons:
- They tell anyone viewing the link what to expect from the resource when they click the link.
- Slug of the page also tells search engines about the content that is available at the link
- As search engine bots scan the slug of a page, they capture the keywords of the content available on the page without actually going to the page. hese page-level keywords help the bots present the page quickly when someone asks for the keyword in their search paramters.
- Because of the above three reasons, a slug is more critical for improving your page SEO and giving your page a chance to be displayed in the search engine result pages.
Are slugs good for SEO?
SEO stands for Search Engine Optimization. Web developers usually use this term to improve their page content so that humans and search engine bots can easily find their page contents. If the bots can analyze your content and place it higher in rank compared to similar content, your web page will rank higher in SERP (Search Engine Results Page). So, slugs are good for SEO and one area where you can easily make sure to add the keywords for which you want to rank in the search results.
Creating your slug in lines with your page title works best. Having your keywords in your page title and URL slug will allow the content and page-level keywords to be in sync. There are many approaches in which you can create your slug. It can become a challenge to be consistent. We have created a simple slug generator for you to create your slug with confidence and consistency. Url Slug Generator