Free Online Slug Url Generator

This tool will help you to generate a url slug from a string of any content.


What is Slug Url?

The URL slug is the part at the end of the URL and is actually the exact address of a particular page on your website. In SEO engineering, it is recommended to create a URL Slug that is between 3 and 5 words in length. That will make the website's path more SEO and user friendly.

URL Slug Examples

Web Page Title SEO-friendly URL Slug
What is a slug and how to optimize it? what-is-a-slug-and-how-to-optimize-it
How do you create a slug URL? how-do-you-create-a-slug-url
Why is it called a URL slug? why-is-it-called-a-url-slug
Search engine optimization search-engine-optimization
Generate url slug with Nodejs generate-url-slug-with-nodejs
How to generate url slug in php? how-to-generate-url-slug-in-php

How do you create a slug URL?

The perfect URL slug should give an idea of the content from the first sight. Such a rule helps not only to understand what's hidden in the link but also to improve website SEO.

  • Divide the words using the "-" symbol
  • Add key queries to a slug
  • Optimize a slug length

How to generate url slug in PHP?

This is PHP function to make slug (URL string)

function php_slugify($text) {
        $text = preg_replace('~[^\pL\d]+~u', '-', $text);
        $text = iconv('utf-8', 'us-ascii//TRANSLIT', $text);
        $text = preg_replace('~[^-\w]+~', '', $text);
        $text = trim($text, '-');
        $text = preg_replace('~-+~', '-', $text);
        $text = strtolower($text);
        return $text;
    }

How to generate url slug in Javascript?

This is js function to make slug (URL string).
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize
The normalize() method returns the Unicode Normalization Form of a given string.

function js_slugify(text) {
  return text.toString() // Cast to string
  .toLowerCase() // Convert the string to lowercase letters
  .normalize('NFD') // The normalize() method returns the Unicode Normalization Form of a given string.
  .trim() // Remove whitespace from both sides of a string
  .replace(/\s+/g, '-') // Replace spaces with -
  .replace(/[^\w\-]+/g, '') // Remove all non-word chars
  .replace(/\-\-+/g, '-'); // Replace multiple - with single -
}