slugify
URL slug generation library. Converts strings to URL-safe slugs by replacing spaces with hyphens, removing special characters, transliterating Unicode characters to ASCII, and lowercasing. Supports 200+ Unicode character transliterations (German umlauts, French accents, Cyrillic, Arabic, etc.). Used for generating SEO-friendly URLs from titles, blog post slugs, and file name sanitization.
Score Breakdown
⚙ Agent Friendliness
🔒 Security
Zero security surface — pure string transformation. Output should still be validated/sanitized if used in database queries or file paths.
⚡ Reliability
Best When
You need to convert human-readable strings to URL-safe, lowercase hyphenated slugs with Unicode support.
Avoid When
You need unique guarantees — slugify is deterministic but not unique; two different strings may produce the same slug.
Use Cases
- • Generate URL slugs from blog post or product titles: 'Hello World!' → 'hello-world'
- • Create file system-safe names from user-provided strings by removing special characters
- • Generate database-friendly identifiers from display names for URL routing
- • Transliterate international characters to ASCII for ASCII-only URL requirements: 'Üniversität' → 'universitaet'
- • Sanitize user-provided names for use as route parameters or subdomain identifiers
Not For
- • Unique ID generation — slugify doesn't guarantee uniqueness; check for collisions in your data store
- • Complex URL manipulation — use the URL API or path libraries for full URL parsing/building
- • Unicode normalization for non-URL purposes — use unorm or native String.normalize() for general Unicode normalization
Interface
Authentication
No authentication — string utility library.
Pricing
Fully free, MIT licensed.
Agent Metadata
Known Gotchas
- ⚠ Slugs are NOT unique — 'Hello World' and 'Hello World!' both produce 'hello-world'; implement uniqueness via database constraints and collision handling (append counter)
- ⚠ Entirely non-ASCII input with no transliteration may produce empty string — check for empty output and handle: if (!slug) use a fallback ID
- ⚠ strict: true mode removes all characters not in the allow list — may be too aggressive for titles with valid punctuation; test your expected input range
- ⚠ Custom character mappings via extend() option — for domain-specific transliteration (technical symbols, currency signs) that default mapping doesn't cover
- ⚠ Trimming: input whitespace at start/end is trimmed by default — but multiple consecutive spaces between words are collapsed to single hyphen
- ⚠ max length: slugify doesn't enforce max slug length — long titles produce long slugs; truncate to URL-safe length after slugifying to prevent URL length limit issues
Alternatives
Full Evaluation Report
Comprehensive deep-dive: security analysis, reliability audit, agent experience review, cost modeling, competitive positioning, and improvement roadmap for slugify.
AI-powered analysis · PDF + markdown · Delivered within 30 minutes
Package Brief
Quick verdict, integration guide, cost projections, gotchas with workarounds, and alternatives comparison.
Delivered within 10 minutes
Score Monitoring
Get alerted when this package's AF, security, or reliability scores change significantly. Stay ahead of regressions.
Continuous monitoring
Scores are editorial opinions as of 2026-03-07.