Case Converter: kebab-case

Convert text to kebab-case. Example: Hello World → hello-world

Input
Loading...
Output (kebab-case)
Loading...

Example: Before and After

Before (input)

User profile settings

After (output)

user-profile-settings
About This Tool

Convert text to kebab-case format, where spaces are replaced with hyphens and all letters are lowercase. This format is commonly used in URLs, CSS class names, and HTML attributes.

Common Use Cases
  • Creating URL slugs for web pages
  • Formatting CSS class names
  • Generating HTML element IDs
  • Creating readable file names
How to Use
  1. Enter your text (words separated by spaces)
  2. The text is converted to kebab-case format
  3. Copy the result for URLs or CSS
Features
  • Replaces spaces with hyphens
  • Converts to lowercase
  • URL-safe format
Tips

kebab-case is preferred for URLs because hyphens are treated as word separators by search engines.

Introduction: SEO-Friendly URL and CSS Naming

The kebab-case converter transforms text into the naming format where words are lowercase and separated by hyphens, creating identifiers like user-profile, blog-post-title, or nav-menu-item. This naming convention is the standard for URLs, CSS class names, HTML IDs, and other web-facing identifiers. The name comes from the visual resemblance to words skewered on a kebab stick, connected by hyphens.

Kebab-case is particularly important for SEO (Search Engine Optimization) because search engines like Google treat hyphens as word separators, correctly interpreting "blog-post-title" as three separate words. In contrast, underscores or lack of separators can cause search engines to treat multi-word phrases as single terms, potentially harming discoverability. This makes kebab-case the universally preferred format for URL slugs and web resource names.

Beyond URLs, kebab-case is the recommended convention for CSS class names in methodologies like BEM (Block Element Modifier) and is widely used for HTML element IDs. Its lowercase-with-hyphens format creates readable, URL-safe, and universally compatible identifiers that work consistently across all browsers, operating systems, and web technologies.

Who Uses Kebab Case?

Web developers and frontend engineers use kebab-case extensively for CSS class names and HTML IDs, creating selectors like .user-profile or #main-navigation. SEO specialists and content managers use it for URL slugs, converting article titles into SEO-friendly URLs like /blog/how-to-optimize-images. Package and library names in npm (Node Package Manager) often use kebab-case, such as express-validator or body-parser.

Web designers working with CSS frameworks like Bootstrap and Tailwind CSS use kebab-case for custom class names that integrate with existing utility classes. DevOps engineers use kebab-case for Docker container names, Kubernetes resource names, and configuration file names where hyphens are preferred over underscores or spaces. Static site generators like Jekyll and Hugo use kebab-case for file names and URL structures.

How Kebab Case Conversion Works

The tool processes text by identifying word boundaries (spaces, underscores, or capital letters in mixed-case text), converting all letters to lowercase, and joining words with hyphen characters. For example, "User Profile Page" becomes "user-profile-page". The algorithm removes special characters that aren't URL-safe and replaces all separators with hyphens.

The conversion handles various input formats intelligently. Whether you provide "User Profile" (Title Case), "userProfile" (camelCase), or "user_profile" (snake_case), it correctly identifies word boundaries and converts to kebab-case. This flexibility makes it perfect for converting natural language phrases, database column names, or existing code identifiers into web-friendly formats.

Example: Before and After

Before: "About Our Company"

After: "about-our-company"

Multiple Use Cases:

  • "contact us" → "contact-us" (URL slug)
  • "Main Navigation Menu" → "main-navigation-menu" (CSS class)
  • "userProfile" → "user-profile" (ID attribute)
  • "product_category" → "product-category" (file name)

All conversions create clean, lowercase, hyphen-separated identifiers perfect for web use.

Why Kebab Case is Essential for Web Development

Kebab-case is the only naming convention that's universally URL-safe, SEO-friendly, and human-readable. Search engines parse hyphens as word separators, so "best-pizza-recipes" is understood as three distinct keywords, improving search ranking. Underscores don't provide this benefit, and camelCase or PascalCase can appear awkward in URLs where case sensitivity varies by server configuration.

The convention's lowercase-only approach eliminates case-sensitivity concerns that can cause broken links on case-sensitive servers. A URL like /About-Us might work locally but fail on production if the server expects /about-us. Kebab-case prevents these issues entirely. Additionally, hyphens are easier to type and read in URLs compared to underscores (which require the shift key) or camelCase (which looks awkward in URLs).

Frequently Asked Questions

Why are hyphens better than underscores for URLs?

Search engines treat hyphens as word separators but often treat underscores as word connectors. This means 'best-pizza' is seen as two keywords while 'best_pizza' might be seen as one, affecting SEO.

Should CSS class names always use kebab-case?

While not strictly required by CSS, kebab-case is the overwhelming convention for class names and is recommended by all major CSS methodologies (BEM, SMACSS, OOCSS).

Can this convert from camelCase?

Yes, the tool recognizes capital letters as word boundaries in camelCase or PascalCase and correctly converts them to kebab-case.

Are uppercase letters allowed in URLs?

While technically allowed, URLs are case-sensitive on many servers, making uppercase problematic. Kebab-case ensures compatibility by using only lowercase.

Is this tool secure?

Yes, all conversions happen in your browser. No text is sent to servers, stored, or logged, ensuring complete privacy for your URLs and code.

Can I use kebab-case for file names?

Absolutely. Kebab-case creates clear, readable file names that work consistently across all operating systems without special character escaping.

Related Tools