Text SlugifierFree online other calculator — instant results, no sign-up
Create a lowercase ASCII slug from text.
Sign in to save results and favorites.
About the Text Slugifier
The Text Slugifier converts text into a lowercase ASCII slug for use in URL paths or web identifiers. It turns the default text, “Hello world. This is a sample.”, into “hello-world-this-is-a-sample”, removing punctuation and using hyphens between words.
- Text
- The text to convert into a slug, defaulting to “Hello world. This is a sample.”; it is a character string with no measurement units.
Formula and method
S = trimHyphens(replaceRuns(lowercase(T), /[^a-z0-9]+/g, "-")); for T = "Hello world. This is a sample.", S = "hello-world-this-is-a-sample".
- TThe original text entered in the Text field.
- SThe resulting lowercase ASCII slug.
- lowercaseConverts uppercase letters to lowercase.
- replaceRunsReplaces each consecutive run of characters matching the pattern with one hyphen.
- /[^a-z0-9]+/gA pattern matching every run of characters other than lowercase ASCII letters and digits.
- trimHyphensRemoves hyphens from the beginning and end of the result.
Slugification is a text transformation rather than a numerical calculation. A rule consistent with the supplied example is to lowercase the input, replace runs of non-ASCII-letter-or-digit characters with a hyphen, and remove leading or trailing hyphens. For the default text, this lowercases “Hello”, converts the spaces and punctuation into separators, and removes the separator left by the final period.
Worked example
These are the calculator's starting values and the results it actually produces for them.
Inputs
- TextHello world. This is a sample.
Results
- Slughello-world-this-is-a-sample
How to use the Text Slugifier
- 1Enter or paste your source text into the Text field.
- 2To reproduce the worked example, leave the input as “Hello world. This is a sample.”.
- 3Run the conversion if required, or read the result if the page updates automatically.
- 4Check that the Slug output is “hello-world-this-is-a-sample” for the default input.
- 5Copy the slug into the intended URL path or identifier field, checking any requirements imposed by that system.
Reading your result
The Slug row contains the transformed text, not a number or a complete URL. With the default input, Slug = hello-world-this-is-a-sample. The words appear in their original order, all letters are lowercase, and hyphens separate the words without a leading or trailing hyphen.
Limitations
The supplied example establishes the result for ordinary English text with spaces and periods; it does not establish the exact handling of accents, non-Latin scripts, emoji, or every punctuation mark. The formula describes a common ASCII-only rule consistent with that example, but transliteration or Unicode normalization may differ in the implementation. Slugification loses capitalization and punctuation, so it cannot reliably reconstruct the original text. It also does not guarantee uniqueness, enforce a destination's length limits, or check reserved URL paths.
Common questions
What happens to the periods in the default text?+
Neither period remains in the slug. The period after “world” and its following space become a single word separator, while the final period leaves no trailing hyphen.
Does Text Slugifier create a complete URL?+
No. It produces a slug such as “hello-world-this-is-a-sample”; you must supply the domain and any other path components separately.
Will accented letters always become their unaccented equivalents?+
That behavior is not established by the supplied example. Under the formula shown here, characters outside ASCII letters and digits become separators rather than being transliterated; check the actual output before using text with accents or non-Latin scripts.
Can different text inputs produce the same slug?+
Yes. Lowercasing and removing punctuation can make distinct inputs identical after conversion. If slugs identify separate pages or records, the destination system must check for duplicates.
Does the calculator save my information?+
Calculations run in your browser. While signed in, inputs and results are automatically recorded in account history; saving a result creates a separate saved record.
You might also like
Word Counter
Count whitespace-separated words.
Character Counter
Count Unicode code points with and without whitespace.
Sentence Counter
Estimate sentences using terminal punctuation.
Line Counter
Count logical lines, including a trailing empty line.
Text Reverser
Reverse the order of Unicode code points.
Text Palindrome Checker
Check a palindrome while ignoring punctuation and letter case.
Results are estimates for informational purposes and are not financial, medical or legal advice.