Slugify string

Make a string URL-, filename- and ID-safe

No uploads — conversion happens locally in your browser

Last updated: February 4, 2026
Frank Zhao - Creator
CreatorFrank Zhao

Introduction / overview

A slug is a simplified version of text that stays readable while removing characters that often cause trouble in URLs, filenames, and identifiers. Think of it as a clean label you can safely paste into a path, a file, or a database key.

Slugs are especially useful when your input contains spaces, punctuation, accents, or mixed casing.

What problems does it solve?

  • Creates human-friendly URLs for titles and headings.
  • Makes filenames consistent across operating systems.
  • Generates stable IDs you can store and compare.

Who is this for?

  • Writers and marketers turning article titles into clean links.
  • Developers building routes, IDs, and tags.
  • Anyone normalizing filenames before sharing or uploading.

Privacy note: the conversion runs locally in your browser. If you also need to percent-encode a full URL, pair this with our URL Encoder.

How to use / quick start

1

Paste your text

Type or paste the original string into the Input box.

2

Review the slug output

The Output updates instantly. It typically lowercases text and replaces separators.

3

Copy with one click

Press the Copy button to copy the slug to your clipboard.

Two worked examples

x=Hello World 2026x=\texttt{Hello\ World\ 2026}\Rightarrowslug(x)=hello-world-2026\mathrm{slug}(x)=\texttt{hello-world-2026}
y=Cafeˊ & Creˋmey=\texttt{Caf\'e\ \&\ Cr\`eme}\Rightarrowslug(y)=cafe-creme\mathrm{slug}(y)=\texttt{cafe-creme}

If you need strict URL encoding (for example spaces to %20\%20), use URL Encoder. Slugifying and encoding solve different problems.

Real-world examples / use cases

Blog post URLs

Background: you want a readable link for a post title.

x=x=How\texttt{How}to\texttt{to}Slugify\texttt{Slugify}Titles\texttt{Titles}\Rightarrowslug(x)=\mathrm{slug}(x)=how-\texttt{how-}to-\texttt{to-}slugify-\texttt{slugify-}titles\texttt{titles}

Use the result in a route like /blog/\texttt{/blog/}how-\texttt{how-}to-\texttt{to-}slugify-\texttt{slugify-}titles\texttt{titles}.

Consistent filenames

Background: you save exports with predictable names.

x=Client Update Q1x=\texttt{Client\ Update\ Q1}\Rightarrowslug(x)=client-update-q1\mathrm{slug}(x)=\texttt{client-update-q1}

Result: easier sorting, fewer issues across devices.

Tags and categories

Background: user-entered tags need to match reliably.

x=C# Tipsx=\texttt{C\#\ Tips}\Rightarrowslug(x)=c-sharp-tips\mathrm{slug}(x)=\texttt{c-sharp-tips}

If you also normalize casing, pair it with Case Converter.

Stable IDs for copies

Background: you want IDs that stay consistent for the same label.

x=Team Alphax=\texttt{Team\ Alpha}\Rightarrowslug(x)=team-alpha\mathrm{slug}(x)=\texttt{team-alpha}

If you need a fixed-length identifier, you can hash the slug using Hash Text.

Common scenarios / when to use

URL path segments

Great for turning headings into readable paths.

Not a replacement for percent-encoding reserved URL characters.

Cross-platform filenames

Helps avoid odd characters that break uploads or tooling.

Still avoid reserved names and extremely long filenames.

Human-readable IDs

Useful when IDs appear in logs or support tickets.

If uniqueness matters, add a suffix or hash.

Cleaning messy input

Removes punctuation and normalizes spacing.

Be careful with meaningful symbols like plus or slash.

Sanitizing for systems

Helps reduce input variability before storage.

It is not a security filter; validate on the server too.

Sharing links

Share the input and let others reproduce the same output.

For full URLs, encode after building the final URL.

Tips & best practices

Keep slugs stable

If you use slugs as IDs, changing your rules later will break links. Decide on a format once and keep it.

Prevent collisions

  • Add a short suffix, for example a date or an incrementing number.
  • For a compact unique token, hash the slug using Hash Text.

Slugify versus encode

Slugify makes text readable and safe-ish for paths. URL encoding preserves exact characters for transport. If you must preserve symbols, use URL Encoder.

Calculation method / formula explanation

Slugification is a sequence of text transforms. The exact rules can vary by project, but the idea is consistent: normalize, replace, filter, and tidy.

slug(s)\mathrm{slug}(s)==trim(\mathrm{trim}(collapse(\mathrm{collapse}(filter(\mathrm{filter}(replace(\mathrm{replace}(normalize(s)\mathrm{normalize}(s)))))))))

A readable mental model of the pipeline

Key pieces explained

  • normalize(s)\mathrm{normalize}(s): reduces weird Unicode forms so comparisons are more reliable.
  • replace()\mathrm{replace}(\cdot): maps common symbols and accented characters to simpler equivalents.
  • filter()\mathrm{filter}(\cdot): removes characters outside an allowed set.
  • collapse()\mathrm{collapse}(\cdot): converts repeated separators to a single separator.
  • trim()\mathrm{trim}(\cdot): removes leading and trailing separators.

Allowed character idea

Keep characters in \text{Keep characters in }{\{a..z\texttt{a..z},,0..9\texttt{0..9},,-\texttt{-}}\} and remove the rest.\text{ and remove the rest.}

Related concepts / background info

URL path segments

A slug is often used as one part of a URL path. It is meant to be readable. A URL encoder is meant to preserve exact characters for transport.

Normalization

Unicode normalization helps ensure that visually similar text becomes comparable. This matters when users type accents or paste from different sources.

Safety and validation

Slugifying reduces risky characters, but it does not replace server-side validation and authorization. Treat slugs as user input.

Frequently asked questions (FAQs)

Why do I get dashes instead of spaces?

Slugs use a separator so words stay readable. A common choice is a dash. You can think of it as turning whitespace into a safe character.

Can I slugify a full URL?

You can, but it usually removes meaningful characters like :: and //. If you want to preserve the URL and encode it safely, use URL Encoder.

Will two different inputs ever produce the same slug?

Yes. If different strings normalize and filter to the same characters, the output can match. If uniqueness matters, add a suffix or hash the slug.

Does this tool support accents and non-Latin text?

It attempts to normalize many characters. Results depend on the mapping rules and the target system. Always test with your expected languages.

Should I lowercase everything?

Lowercasing is common because it avoids duplicates that differ only by case. If your system is case sensitive, consistent casing prevents bugs.

How do I interpret the result?

The Output is the slug you can paste into paths, filenames, or IDs. When in doubt, test it in the exact place you plan to use it.

Limitations / disclaimers

Slug rules are opinionated. If you need a specific format for a framework or a database, validate with your target system.

What this tool does not do

  • It is not a security sanitizer for HTML, SQL, or scripts.
  • It does not guarantee uniqueness without additional logic.
  • It does not replace URL encoding for full URLs.
Slugify string | CalculatorVast