Case Converter

Convert text to camelCase, snake_case, PascalCase, kebab-case and 10+ other styles

What Is a Case Converter?

A case converter is a small utility that rewrites text into a different naming style. Programmers use it constantly: switching a variable from camelCase to snake_case when porting code from JavaScript to Python, generating CONSTANT_CASE environment variable names from a feature description, or producing a kebab-case CSS class from a component name. This tool covers every common case style in one panel — paste your text, and you get every variant at once.

Common Case Styles

StyleExampleWhere it’s used
camelCasehelloWorldExampleVariables and functions in JavaScript, Java, Kotlin, Swift
PascalCaseHelloWorldExampleClasses, types, components (React, C#, TypeScript)
snake_casehello_world_exampleVariables and functions in Python, Ruby, Rust
CONSTANT_CASEHELLO_WORLD_EXAMPLEConstants and environment variables everywhere
kebab-casehello-world-exampleURLs, CSS classes, HTML attributes, CLI flags
COBOL-CASEHELLO-WORLD-EXAMPLEHTTP headers (in some style guides), legacy COBOL
Train-CaseHello-World-ExampleSome HTTP headers (Content-Type), book titles
Title CaseHello World ExampleArticle titles, UI labels
Sentence caseHello world exampleBody copy, button labels (modern UI guidelines)
dot.casehello.world.exampleJava package names, config keys
path/casehello/world/exampleURL paths, file system paths

How to Convert Cases

  1. Paste any text into the input area — a single identifier, a sentence, or many lines at once.
  2. Press Ctrl+Enter or click the Convert button. The output panel shows every case variant.
  3. Copy the line you need. The whole table copies with one click via the Copy button or Ctrl+Shift+C.
  4. Type to convert in real time — the tool re-converts on every keystroke (debounced) so you can iterate quickly.

The conversion is fully bidirectional. You can paste helloWorldExample, hello_world_example, hello-world-example or Hello World Example — the tool detects the original style by scanning for word boundaries and re-emits the value in every other style.

How Word Boundaries Are Detected

A robust case converter has to recognize where words begin and end no matter how the input is formatted. This tool uses three rules:

  • Separator characters — underscores (_), hyphens (-), spaces, dots (.), and slashes (/) split the input into words.
  • Case transitions — a lowercase letter followed by an uppercase letter starts a new word (helloWorldhello, World).
  • Acronym handling — a sequence of uppercase letters followed by a lowercase letter splits before the last uppercase (XMLHttpRequestXML, Http, Request). This matters when you convert acronym-heavy code.

Numbers stay attached to the surrounding word (getHTML5PlayergetHtml5Player or get_html5_player), which is what most style guides prescribe.

camelCase vs snake_case

This is the most-Googled case-conversion question. The answer is mostly cultural, not technical:

  • JavaScript, TypeScript, Java, Kotlin, Swift, C# — community style guides and language conventions favor camelCase for variables and methods. The standard library is camelCase. Frameworks like React lean on PascalCase for components and camelCase for props.
  • Python and Ruby — PEP 8 (Python) and the Ruby community guide both prescribe snake_case for variables, functions and module names. PascalCase is reserved for classes; CONSTANT_CASE for constants.
  • Rust and Go — Rust uses snake_case for items and PascalCase for types. Go uses MixedCaps (essentially PascalCase for exported, camelCase for unexported) and lints any deviation.
  • C and C++ — historically snake_case in the standard library and many older codebases; many modern style guides allow either.
  • SQL — most teams use snake_case for table and column names because identifiers are case-insensitive in many engines and quoting mixed-case is awkward.

When in doubt: read the existing code in the repo and match its style. Consistency inside one project beats any abstract preference for one style over another.

Common Mistakes When Converting Case

  • Losing acronym capitalization — naive conversion turns parseHTML into parsehtml instead of parse_html. Use a converter that recognizes acronym runs.
  • Concatenating numbers into separate wordsmp3Player should become mp3_player, not mp_3_player. Most style guides keep digits glued to the preceding word.
  • Mangling Unicode letters — accented characters like é and ñ should keep their case-folding behavior. This tool uses JavaScript’s toLowerCase() and toUpperCase(), which respect Unicode rules.
  • Trimming meaningful separators — converting a file path like src/components/Button.tsx should preserve the path structure, not flatten it. If you’re working with paths, use the dedicated path/case output.

When to Use This Tool

  • Porting code between languages — translate a Python API to TypeScript, or the other way around, and rename every identifier.
  • Generating environment variable names — turn a feature description like “stripe webhook secret” into STRIPE_WEBHOOK_SECRET.
  • Building CSS class names from component namesUserProfileCarduser-profile-card.
  • Cleaning up a CSV header rowFirst Name, Last Name, Email Addressfirst_name, last_name, email_address for SQL ingestion.
  • Renaming a batch of identifiers — paste an entire list, get the converted output, paste it back.

Everything runs locally in your browser. No data leaves your machine, which means you can safely paste internal identifiers, API endpoints or proprietary feature names without worrying about a third-party server logging them.

Frequently Asked Questions

What is camelCase?

camelCase is a naming convention where the first word starts with a lowercase letter and each subsequent word starts with an uppercase letter, with no spaces or separators. Example: helloWorldExample. It's the default style for variables and functions in JavaScript, Java, and Swift.

What is the difference between camelCase and PascalCase?

camelCase starts with a lowercase letter (helloWorld), while PascalCase starts with an uppercase letter (HelloWorld). PascalCase is also called UpperCamelCase. The rule of thumb in most languages is: PascalCase for classes and types, camelCase for variables and functions.

How do I convert camelCase to snake_case?

Paste your camelCase text into the input field. The tool detects word boundaries automatically by looking at lowercase-to-uppercase transitions and outputs all case variants instantly, including snake_case. For example, helloWorldExample becomes hello_world_example.

Which case style should I use in my code?

Follow the convention of the language and project you're working in. Python and Ruby prefer snake_case for variables and functions. JavaScript, Java, Kotlin and Swift prefer camelCase. CSS classes and HTML attributes use kebab-case. Constants in most languages use SCREAMING_SNAKE_CASE.

Can I convert multiple lines at once?

Yes. Paste any block of text and each non-empty line is converted independently. This is useful when you have a list of variable names that need to be reformatted in bulk — for example, when porting an API spec from one language to another.

Is my text sent to a server?

No. All conversion happens entirely in your browser using JavaScript. Your text never leaves your machine, which makes the tool safe to use with proprietary code, internal API names or sensitive identifiers.

What does CONSTANT_CASE mean?

CONSTANT_CASE — also called SCREAMING_SNAKE_CASE — is a style where all letters are uppercase and words are separated by underscores. It's used for constants and environment variables in most languages: MAX_RETRY_COUNT, DATABASE_URL, API_KEY.