kebab-case to snake_case converter
Paste hyphenated names and get them back with underscores in lowercase, ready as variable or column names.
Loading the tool…
Processing and privacy: The result is calculated inside your browser and your data is not sent to any server.
How to use it
- Enter kebab-case names (one per line or inside text).
- The result appears straight away and updates as you edit.
- Copy the result, or copy a link that keeps the same values to share it.
How it is calculated
Each kebab-case name is split into words at the hyphens, and at any capital that follows a lowercase letter. The words are then lowercased and joined with underscores (_). Symbols and spaces around the names are left as they are. Example: dry-run becomes dry_run.
Example
Result: snake_case result: dry_run max_retries output_dir; Names processed: 3.
dry-run max-retries output-dir
dry_run max_retries output_dir
Limits and caveats
- Every word becomes lowercase, so acronyms such as API do not keep their capitals.
- Every word in the pasted text is converted, including keywords and library names, so review the result before pasting it into code.
Questions about this tool
Why is a hyphen not allowed in Python names?
Python reads a hyphen as minus, so dry-run is not a valid variable name while dry_run is.
Is this what argparse does?
Close to it: argparse stores the option --dry-run as args.dry_run by replacing the inner hyphen; the difference is that this tool also lowercases capitals.
Do the two leading hyphens stay?
Yes, --output-dir becomes --output_dir, so remove them if you only want the variable name.
