Loading...
Convert text between camelCase, snake_case, kebab-case, PascalCase, and 8 more formats instantly. Free online naming convention converter for developers.
myVariableNameMyVariableNamemy_variable_nameMY_VARIABLE_NAMEmy-variable-nameMY-VARIABLE-NAMEmy.variable.namemy/variable/nameMy Variable NameMy variable namemy variable nameMY VARIABLE NAMETry these:
const toCamel = s => s.replace(/[-_](.)/g, (_, c) => c.toUpperCase());
const toSnake = s => s.replace(/([A-Z])/g, '_$1').toLowerCase();
const toKebab = s => s.replace(/([A-Z])/g, '-$1').toLowerCase();
const toPascal = s => toCamel(s).replace(/^./, c => c.toUpperCase());
toCamel('my_variable'); // 'myVariable'
toSnake('myVariable'); // 'my_variable'
toKebab('myVariable'); // 'my-variable'
toPascal('my_variable'); // 'MyVariable'import re
def to_snake(s):
return re.sub(r'(?<!^)(?=[A-Z])', '_', s).lower()
def to_camel(s):
parts = s.split('_')
return parts[0] + ''.join(w.capitalize() for w in parts[1:])
to_snake('myVariable') # 'my_variable'
to_camel('my_variable') # 'myVariable'camelCase starts with a lowercase letter, then capitalizes the first letter of each subsequent word — no separators. Example: firstName, getUserData, maxRetryCount. Used in JavaScript, Java, TypeScript variables and function names.
PascalCase capitalizes the first letter of every word including the first — no separators. Example: UserProfile, GetUserData, HttpRequest. Used for React components, C# classes, TypeScript interfaces and types.
snake_case uses lowercase letters with underscores between words. Example: user_name, get_user_data, max_retry_count. Used in Python, Ruby, Rust, database column names, and file names.
kebab-case uses lowercase letters with hyphens between words. Example: user-profile, get-user-data, my-component. Used in CSS class names, URLs/slugs, HTML attributes, and CLI flag names.
SCREAMING_SNAKE_CASE uses uppercase letters with underscores. Example: MAX_RETRY_COUNT, API_BASE_URL, NODE_ENV. Used for constants, environment variables, and enum values across most programming languages.
Use camelCase in JavaScript, TypeScript, Java, C++. Use snake_case in Python, Ruby, Rust, Go (for package names), SQL. Follow the naming convention of your language and team's style guide.
Use kebab-case for: CSS class names (.my-component), URL slugs (/user-profile), HTML data attributes (data-user-id), CLI flags (--output-dir), and npm package names.
React components: PascalCase (UserProfile). Props/state: camelCase (userName). CSS modules: camelCase or kebab-case. File names: PascalCase for components (UserProfile.jsx), kebab-case for utilities.
Variables/functions: snake_case. Classes: PascalCase. Constants: SCREAMING_SNAKE_CASE. Modules/packages: lowercase or snake_case. Private: _leading_underscore. This follows PEP 8.
JavaScript: use lodash (_.camelCase, _.snakeCase, _.kebabCase) or the change-case npm package. Python: use the inflection or stringcase library. Or use our free converter above for quick one-off conversions.
Disclaimer: This tool converts text between common naming conventions. Multi-word detection works best with standard camelCase, snake_case, or space-separated inputs.