Slug Generator

Convert any text into a clean, URL-friendly slug. Handles special characters and Unicode. Free, instant, no signup.

Preparing private browser tool…

Your file will stay on this device.

What a slug is and what makes a good one

A slug is the human-readable part of a URL path that identifies a specific piece of content, as in example.com/blog/how-to-choose-a-database. It replaces an opaque numeric identifier with words, which makes the link legible when it is pasted into a chat, read aloud, or shown as a search result. The word comes from newspaper production, where a slug was the short name given to a story while it moved through the workflow.

The properties that matter are narrow. A slug should use only characters that are safe and unambiguous in a URL, should be lowercase so that two links differing only in case cannot point at different resources, should separate words so they remain readable and individually recognisable, and should be short enough to survive being displayed in full.

It should also be stable. Changing a slug changes the URL, which breaks existing links and loses accumulated ranking signals unless you add a permanent redirect from the old path. Because of this, many systems derive the slug once when content is created and then leave it alone even when the title is later edited.

How this generator transforms your text

The steps run in a fixed order. When strict ASCII is on, the text is first normalised with NFKD, which decomposes an accented character into a base letter plus a separate combining mark, and the combining marks are then stripped. That turns cafe with an acute accent into cafe and Munchen with an umlaut into Munchen. Anything still outside the printable ASCII range is then removed entirely.

Next the text is lowercased if that option is on, and then every run of characters that is not a letter or a digit is collapsed into a single separator. The definition of letter and digit depends on the strict ASCII setting: with it on, only a to z and 0 to 9 survive, while with it off the check uses the Unicode letter and number properties, so Korean, Japanese, Cyrillic and Greek characters are kept as-is.

Finally leading and trailing separators are trimmed, and if a maximum length is set the string is cut to that length and any separator left dangling at the cut is removed. Given Hello, World! How are you? the result with default settings is hello-world-how-are-you, and a maximum length of 12 produces hello-world rather than hello-world-.

ASCII slugs versus Unicode slugs

Turning strict ASCII off produces a slug that keeps its original script, so a Korean title yields a Korean slug. That is legal: RFC 3987 defines internationalised resource identifiers, and every current browser displays them in their native script while percent-encoding them on the wire. A path segment written in Hangul becomes a long run of percent escapes when it appears in a server log or an analytics report.

The argument for ASCII slugs is operational rather than technical. Percent-encoded paths are hard to read in logs, awkward to type on a keyboard that does not have the script, and occasionally mangled by older tools, email clients and chat applications that break the link at an unexpected character. The argument against is that a transliterated or stripped slug can be meaningless to the audience that actually reads the content.

A reasonable default is strict ASCII for a Latin-script site, where the transformation only removes accents, and Unicode slugs for a site whose readers use a non-Latin script, where stripping would leave nothing. Note that the stripping here is not transliteration: it removes characters it cannot reduce to ASCII rather than spelling them out, so a title in Greek or Chinese would produce an empty slug under strict ASCII. Keep a fallback such as an identifier for that case.

Separators, length and uniqueness

Hyphens are the conventional separator and Google has said for years that it treats a hyphen as a word separator and an underscore as a word joiner, so how-to-index reads as three words and how_to_index can read as one. Dots are available here but are best avoided in slugs, since a trailing segment that looks like a file extension can confuse content negotiation and some static hosts.

Length is a judgement call. The default cap of 80 characters is comfortably below any practical URL limit while keeping the slug from swallowing an entire headline. Search engines truncate long URLs in results, and unusually long slugs are harder to share, so trimming to the meaningful words is worthwhile. Dropping stop words such as a, the and of is common practice and this tool leaves that to you.

Nothing here guarantees uniqueness: two different titles can easily normalise to the same slug. Production systems handle that by checking for a collision at save time and appending a counter or a short identifier, as in how-to-choose-a-database-2. Deciding that rule in advance is better than discovering it when the second article fails to save.

Frequently asked questions

Should I use hyphens or underscores?
Hyphens. Search engines treat a hyphen as a word separator and an underscore as a joiner, so my-first-post is read as four words while my_first_post can be read as one. Underscores remain a reasonable choice for filenames and identifiers, just not for URL slugs.
What happens to accented characters?
With strict ASCII on, the text is normalised with NFKD so an accented letter splits into a base letter and a combining mark, and the mark is removed. So a French or German title keeps its words with the accents dropped. Turning strict ASCII off keeps the accented characters intact.
Why is my Korean or Chinese title producing an empty slug?
Strict ASCII removes characters it cannot reduce to ASCII, and it does not transliterate, so a title with no Latin letters is stripped to nothing. Turn strict ASCII off to keep the original script, or supply a separate Latin title to generate the slug from.
Are non-ASCII characters allowed in a URL?
Yes. They are percent-encoded on the wire and current browsers display them in their original script. The practical downsides are readability in logs and analytics, typing them on a foreign keyboard, and occasional mangling by older tools that break links at unexpected characters.
Should I change the slug when I edit an article title?
Usually not. Changing the slug changes the URL, which breaks every existing link and loses accumulated ranking unless you add a 301 redirect from the old path. Most systems generate the slug once at creation and keep it fixed afterwards.
How do I handle two articles that generate the same slug?
This tool does not check uniqueness, since it has no view of your content. The standard approach is to test for a collision when saving and append a counter or a short identifier, producing something like same-title-2, and to store the slug rather than recomputing it on every render.