kebab-case lowercases every word and joins them with hyphens — like "user-first-name" — named because the string of hyphenated words looks a bit like meat on a skewer. It's the standard convention for URL slugs, HTML/CSS attribute and class names, and CLI flags. This converter breaks your input into words wherever it finds spaces, hyphens, underscores, digits, or an existing uppercase letter starting a new word, then rejoins them with hyphens.
Spaces, hyphens, underscores, digit runs, and transitions between lowercase and uppercase letters all split the input into separate words before they're rejoined with hyphens, so this works on snake_case, camelCase, PascalCase, and plain sentences alike.
It's the go-to format for URL slugs ("my-blog-post"), HTML custom attributes and CSS class names, npm package names, and command-line flags like "--dry-run", since hyphens are safe and readable in all of those contexts.
Yes — runs of digits are treated as their own word, so "user2 name" becomes "user2-name" rather than merging the digits into the surrounding text.