Convert text to any case format — UPPERCASE, lowercase, Title Case, Sentence case, camelCase, PascalCase, snake_case, or kebab-case — instantly in your browser.
Different programming languages and contexts have established conventions for naming variables, functions, classes, and files. Using the wrong case breaks conventions and can cause actual runtime errors in case-sensitive languages.
getUserProfile, totalItemCount.UserProfile, ShoppingCart.user_profile, total_item_count.user-profile, main-navigation.DATABASE_URL, MAX_RETRY_COUNT.Use kebab-case (e.g. .main-navigation, .user-card). The HTML and CSS specification and every major CSS methodology (BEM, SMACSS, OOCSS) use hyphens as word separators. Note that HTML is case-insensitive for class names, but CSS is case-sensitive by default, so be consistent. Avoid camelCase in CSS — it is error-prone and non-idiomatic.
Both join words without separators, capitalising word boundaries. The difference is the first character: camelCase starts with a lowercase letter (myFunction), while PascalCase starts with an uppercase letter (MyFunction). In JavaScript, use camelCase for variables and functions, PascalCase for classes and React components.
Python's official style guide (PEP 8) mandates snake_case for function and variable names because Guido van Rossum, Python's creator, believed it improved readability for English readers. Python does use PascalCase for class names (also per PEP 8). snake_case is also the default in Ruby, PHP (for array keys), and SQL column names.
Use a regex replace: str.replace(/_([a-z])/g, (_, c) => c.toUpperCase()). For example, 'user_first_name'.replace(/_([a-z])/g, (_, c) => c.toUpperCase()) produces 'userFirstName'. To go from camelCase to snake_case: str.replace(/([A-Z])/g, '_$1').toLowerCase().