# Convert kebab-case to snake_case

> Convert kebab-case to snake_case online. Free converter for turning slugs and CSS names into Python and SQL identifiers, with a live tool.

URL slugs and CSS class names can't be used directly as Python variables or SQL columns — hyphens aren't legal in those identifiers. This converter swaps the hyphens for underscores, turning kebab-case into valid snake_case line by line.

## Example: kebab-case → snake_case

Input:
```
user-name
created-at
profile-image-url
api-key
```

Output:
```
user_name
created_at
profile_image_url
api_key
```

## How to convert kebab-case to snake_case

1. Split the identifier on each hyphen (user-name → user, name).
2. Lowercase every word.
3. Join the words with underscores.

## FAQ

### Why can't I use hyphens in Python or SQL identifiers?

In Python, user-name parses as user minus name. In SQL, a hyphenated identifier needs constant quoting. Underscores avoid both problems, which is why snake_case is the convention.

### Does this change capitalization?

Everything is lowercased, which is what snake_case expects. If you need SCREAMING_SNAKE_CASE for constants, uppercase the result.

## Related converters

- [snake_case → kebab-case](https://www.devkult.com/convert/snake-to-kebab.md)
- [kebab-case → camelCase](https://www.devkult.com/convert/kebab-to-camel.md)
- [camelCase → snake_case](https://www.devkult.com/convert/camel-to-snake.md)

Open the interactive converter: https://www.devkult.com/convert/kebab-to-snake