Pick the case style that matches your URL, CSS, or JavaScript naming convention.
Compare
📋 _.kebabCase vs related case methods
Topic
_.kebabCase
_.snakeCase
_.camelCase
_.startCase
Separator
Hyphen (-)
Underscore (_)
None (camel)
Space
Case
all lower
all lower
lower + Upper
Title Words
URL slugs
Common
Less common
Rare
Display only
CSS / HTML
class names
constants
JS variables
Headings
Example
foo-bar
foo_bar
fooBar
Foo Bar
🧠 How _.kebabCase() Works
1
Receive input string
Lodash normalizes the string (empty string if null/undefined).
Input
2
Split into words
Spaces, punctuation, and case changes define word boundaries.
Split
3
Lowercase each word
Every word segment is converted to lowercase.
Lower
=
Join with hyphens
Words are joined with - to produce kebab-case output.
Output
Important
📝 Notes
_.kebabCase() returns a new string; the original is unchanged.
Punctuation is removed or treated as a separator—not copied into the result.
For database column names, consider _.snakeCase() instead.
Slugify once and persist slugs rather than recomputing on every request.
Test Unicode and accented characters for your target audience.
Pair with _.deburr() when stripping accents from slugs.
Wrap Up
Conclusion
_.kebabCase() is the go-to Lodash helper when you need hyphenated, lowercase tokens for URLs, CSS classes, and HTML attributes. Use it on page titles, component names, and config labels.
When you need JavaScript identifiers or database column names, reach for _.camelCase() or _.snakeCase() instead.
Yes. Punctuation and most symbols act as word separators and are not preserved in the output.
Yes. It is a common choice for turning page titles or product names into URL-safe hyphenated slugs.
Lodash detects case boundaries, so "fooBarBaz" becomes "foo-bar-baz".
Unicode letters are lowercased and separated by rules similar to ASCII; test with your target locales.
Did you know?
_.kebabCase() shares the same word-splitting rules as _.camelCase() and _.snakeCase()—only the join style differs. For display titles (not URL slugs), use _.startCase() instead.