Text & Writing Utilities · Free tool
Kebab Case Converter
Convert any text to kebab-case (dash-separated) or from kebab-case back to words. Includes slug-safe normalization.
Advertisement
What it does
kebab-case (dash-separated lowercase, named after how it looks like words skewered on a kebab stick) is one of the four main case conventions in programming: camelCase (first-word-lowercase, subsequent-capitalized: getUserName), PascalCase (all-words- capitalized: GetUserName), snake_case (under score-separated lowercase: get_user_name), and kebab-case (dash-separated lowercase: get-user-name). Each has its conventional domain. URLs and routing slugs use kebab-case (twitter.com/user-name, not /userName or /user_name) because dashes are URL-safe and improve readability. CSS properties use kebab-case (background-color, font-size). HTML attributes use kebab-case (data-user-id). File names in many projects use kebab-case for consistency.
The converter handles both directions: words/sentences/camelCase/snake_case → kebab- case, and kebab-case → space-separated words for human reading. The forward conversion handles edge cases that catch naive implementations: camelCase boundaries (split at lowercase-then-uppercase), consecutive-capitals (ParseHTMLDocument → parse-html-document, not parse-h-t-m-l- document), special characters (replace with dashes or strip based on slug-safe mode), unicode (transliterate accented characters: café → cafe), and consecutive-separators (multiple-spaces → single-dash). Reverse conversion is simpler — just split on dashes, capitalize first letter of each word.
Slug-safe mode (URL-friendly) goes further: strip non-alphanumeric characters entirely (keeps only letters, digits, and dashes), collapse multiple consecutive dashes, trim leading/trailing dashes, lowercase everything, transliterate accented or non-Latin characters where possible. Output is guaranteed safe for use in URLs, file names, and most database identifiers. For internationalized URLs, modern browsers accept Unicode-IDN slugs (e.g., café-paris) but compatibility varies — slug-safe ASCII remains the safer default.
Embed this tool on your siteShow snippetHide
Paste this snippet into any page. Loads on-demand (lazy), no tracking scripts, and sized to most dashboards. Replace the height to fit your layout.
<iframe src="https://freetoolarena.com/embed/kebab-case-converter" width="100%" height="720" frameborder="0" loading="lazy" title="Kebab Case Converter" style="border:1px solid #e2e8f0;border-radius:12px;max-width:720px;"></iframe>How to use it
- Paste your text or identifier into the input.
- Pick direction: to-kebab-case (most common) or from-kebab-case-to-words.
- Optionally enable slug-safe mode for URL-friendly output (strips special chars, normalizes Unicode).
- Click Convert and copy the result.
- For batch conversion of many strings, paste line-separated; tool processes each line.
When to use this tool
- Generating URL slugs from blog post titles or product names.
- Converting variable names between languages with different conventions (Java camelCase → CSS kebab-case).
- Naming files consistently in a project that uses kebab-case for filenames.
- Building URL-safe identifiers from arbitrary user-provided text.
- Refactoring code from one case convention to another.
When not to use it
- Languages or contexts where kebab-case isn't accepted — JavaScript variable names can't contain dashes (use camelCase or snake_case).
- Database column naming where snake_case is the SQL standard convention.
- Class names in most languages — those use PascalCase by convention.
- Strict-encoding identifiers (some legacy systems require alphanumeric only, no dashes).
Common use cases
- Quick conversion during a typical workday
- Pre-decision sanity-check on inputs and outputs
- Educational use — demonstrating the underlying concept
- Onboarding a colleague who needs the same calculation/conversion
Frequently asked questions
- Where is kebab-case used?
- URL paths and slugs (twitter.com/john-smith), CSS properties (background-color, font-size), HTML attributes (data-user-id), CLI flags (--max-file-size), Lisp/Clojure variable names (this-is-clojure-style), filename conventions in many JS / web projects (component-name.tsx). Avoided in: JavaScript identifiers (dashes are subtraction operators), Python identifiers (PEP 8 uses snake_case), Java/C# class names (PascalCase).
- How does it handle camelCase?
- Splits at lowercase-then-uppercase boundaries: getUserName → get-user-name. Handles consecutive capitals correctly: ParseHTMLDocument → parse-html-document (not parse-h-t-m-l-document). Acronyms get treated as words. ID becomes id, URL becomes url, NASA becomes nasa, regardless of input casing.
- What's the difference from snake_case?
- Just the separator — kebab uses dashes (-), snake uses underscores (_). Functionally similar; conventional domains differ. Kebab dominates URLs and CSS; snake dominates Python/Ruby/SQL identifiers. Languages that allow dashes in identifiers (Lisp, Clojure) prefer kebab. Languages that don't (most others) use snake or camel.
- How does slug-safe mode handle special characters?
- Strips most non-alphanumeric characters (replaces with dashes or removes entirely depending on context). Transliterates Latin-1 accented characters to ASCII equivalents (é → e, ñ → n, ü → u, ç → c). Collapses multiple consecutive dashes into one. Trims leading/trailing dashes. Output is URL-safe ASCII suitable for / paths and filenames. For Unicode-rich text (Chinese, Arabic, Hebrew), slug generation is harder; some sites use transliteration libraries; others accept Unicode IDN slugs.
- How long should slugs be?
- SEO best practice: under 60 characters typical, ideally 3-5 keywords. Search engines display 50-60 characters of URL in results; longer URLs get truncated. Many CMSes auto-trim slugs to a reasonable length. Don't cram every word from a long title into the slug — pick the 3-5 most-relevant keywords.
- Can I round-trip kebab → words → kebab?
- Mostly yes for simple cases (“hello-world” → “Hello World” → “hello-world”). But information is lost for cases like consecutive capitals (“parse-html-document” → “Parse Html Document” → “parse-html-document” vs “ParseHTMLDocument” → “Parse HTML Document” → “parse-html-document”) — both round-trip to the same kebab but the original casing differs. For lossless round-trip, store original input separately.
Advertisement
Learn more
Guides about this topic
- How-To & Life · GuideHow to Normalize Unicode TextNormalize Unicode text using NFC, NFD, NFKC, and NFKD forms for search and security. A free online guide to handling homoglyph attacks and key normalization in seconds.
- Money & Business · GuideHow to write SEO-friendly URLsBuild clear URLs with smart slugs, structural patterns, and 301 redirects. Improve canonicalization and check URL health instantly with our free tips.
- Productivity & Focus · GuideHow to generate good acronymsCreate acronyms using pronounceability rules and backronym patterns. Generate unique acronyms instantly with our free online tool, no download required.
- How-To & Life · GuideHow to Reverse TextReverse text by character or word and handle Unicode, emoji, and RTL scripts accurately. Free, instant, no sign-up needed.
- How-To & Life · GuideHow to Sort Lines of TextSort lines of text alphabetically, numerically, or naturally with case and locale options. Free instant browser tool, no sign-up.
- How-To & Life · GuideHow to Remove Line BreaksFlatten text line breaks while keeping paragraph structure intact free online. Use regex patterns and undo-able strategies instantly with no download required.
Explore more text & writing utilities tools
- Emoji PickerSearch and copy from 80 most-used emoji across 7 categories in your browser. Instant, free access with no account or download needed.
- Strikethrough Text GeneratorApply strikethrough, underline, double‑underline, overline, or slash using Unicode real text. Free online tool works instantly in your browser — pastes anywhere with no sign‑up.
- Duplicate Line RemoverDeduplicate text lines with case-insensitive or strict modes online. Clean your lists instantly — a free tool with no sign-up or download needed.
- Sort LinesSort lines of text alphabetically, naturally (file‑2 < file‑10), by length, or shuffle. Free instant online tool with optional dedup and trim — no sign‑up needed.
- Flip TextFlip, reverse, or strikethrough your text using real Unicode symbols instantly. Works on social apps, free tool with no sign-up.
- Anagram CheckerCheck whether two words or phrases are anagrams. Ignores case and punctuation. Free, browser-only.