TPToolpazar

Global Araç

Kebab Case Converter

kebab-case biçimine
kebab-case biçiminden

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.

Nasıl Kullanılır

  1. Paste your text or identifier into the input.
  2. Pick direction: to-kebab-case (most common) or from-kebab-case-to-words.
  3. Optionally enable slug-safe mode for URL-friendly output (strips special chars, normalizes Unicode).
  4. Click Convert and copy the result.
  5. For batch conversion of many strings, paste line-separated; tool processes each line.

Ne Zaman Kullanılır

  • 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.

Ne Zaman Kullanılmaz

  • 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).

Yaygın Kullanım Senaryoları

  • 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

Sık Sorulan Sorular

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.