Ahmed Essam
Ahmed Essam's blog

Ahmed Essam's blog

Slug vs ID

Ahmed Essam's photo
Ahmed Essam
·May 26, 2022·

1 min read

Hello there, today we are going to discuss a light topic which is the difference between a slug and an ID.

If you don't know slugs, then this mini-blog will be useful for you.


First of all, a slug is a unique string that identifies a specific resource in web services. You can treat it as an ID, but in a string format not numbers

Slugs are mostly used in URLs to identify a product, blog, post, etc. example: "headphones.com/streo-headphones-123"


The main difference is that slugs are human-readable, unlike IDs, so slugs can be used as a unique identifier, and at the same time a string that can be read.

That is all for this mini-blog as I covered the key difference between slugs and IDs. Hope you found it useful

Share this