Convert Text to kebab-case Online Convert text to kebab-case for CSS classes, URLs, and file names.
kebab-case Converter
Convert text to kebab-case for CSS classes, URLs, and file names.
Paste Your Text
Type or paste text to convert to kebab-case.
Preview the kebab-case Output
See lowercase hyphenated output instantly.
Copy the Converted Text
Copy for CSS classes, URLs, or file names.
What Is kebab-case Converter?
A kebab-case converter transforms text into kebab-case format, where all letters are lowercase and words are separated by hyphens. Developers who work with CSS, HTML, and JavaScript use it to convert camelCase or PascalCase names to a format compatible with their frameworks. One specific problem it solves is handling long strings of text that need to be converted to kebab case for use in URL slugs or npm package names.
The tool uses regular expressions to split words in the input string, replacing underscores, hyphens, and periods with spaces before converting them to lowercase and joining with hyphens. This process allows it to handle complex strings like "helloWorld" or "background-color-test", producing output like "hello-world" and "background-color-test".
What makes this tool different is its ability to process multiline input, splitting each line into words and then joining them back together with hyphens before returning the result. It acts as a kebab-case generator, allowing users to convert text to kebab-case online without having to write custom code or use a separate text editor. For example, if you paste "Hello World" and "backgroundColor" into the tool, it will output "hello-world" and "background-color", which can then be used directly in your code. The output is formatted with each line on a new line, making it easy to copy and paste into your project.
Why Use kebab-case Converter?
-
Standard for CSS class names and custom properties
-
Required format for URL slugs in most web frameworks
-
Used for npm package names and Git branch names
-
Most readable format for multi-word identifiers in web contexts
-
Handles conversion from any input format
Common Use Cases
CSS Classes
Format class names following BEM or standard CSS naming conventions.
URL Slugs
Create SEO-friendly URL paths from page titles or content headings.
npm Packages
Apply npm's required naming convention for published packages.
File Naming
Name files in kebab-case for Angular, Vue, and other component-based frameworks.
Technical Guide
kebab-case conversion follows the same word-splitting algorithm as snake_case but joins words with hyphens instead of underscores. Input is split on whitespace, underscores, dots, existing hyphens, and case transitions. All words are converted to lowercase and joined with single hyphens. Consecutive hyphens are collapsed, and leading/trailing hyphens are removed. The algorithm correctly handles camelCase input ("backgroundColor" → "background-color"), PascalCase ("PageTitle" → "page-title"), and mixed formats. Note that kebab-case identifiers cannot be used directly as variable names in most programming languages because the hyphen is the subtraction operator.
Tips & Best Practices
-
1CSS properties are natively kebab-case: background-color, font-size, border-radius
-
2BEM methodology uses kebab-case with double hyphens: block__element--modifier
-
3kebab-case URLs are preferred for SEO over underscores or camelCase
-
4In JavaScript, access kebab-case properties with bracket notation: obj["my-prop"]
-
5Angular uses kebab-case for component selectors (app-user-profile)
Related Tools
camelCase Converter
Convert text to camelCase for JavaScript variables and function names.
📝 Text Tools
PascalCase Converter
Convert text to PascalCase for class names and component naming.
📝 Text Tools
snake_case Converter
Convert text to snake_case for Python variables and database columns.
📝 Text Tools
dot.case Converter
Convert text to dot.case format for configuration keys and properties.
📝 Text Tools
Slug Generator
Generate URL-friendly slugs from text with customizable separators.
📝 Text ToolsFrequently Asked Questions
Q What is kebab-case?
Q Why can't I use kebab-case for JavaScript variables?
Q Is kebab-case better than snake_case for URLs?
Q How do CSS custom properties use kebab-case?
Q How does BEM relate to kebab-case?
About This Tool
kebab-case Converter is a free online tool by FreeToolkit.ai. All processing happens directly in your browser — your data never leaves your device. No registration or installation required.