Text

Spaces to Underscores Converter

Input

Replace spaces with underscores. Great for variable naming and file paths.

Options are applied line-by-line.

Output

Sample_line_one
Line_with_leading_and_trailing_spaces
Line_with_multiple_spaces

Frequently Asked Questions

When should I use underscores instead of dashes?
Underscores are conventional in Python variable names (snake_case), database column names, and file names in some systems. URL slugs conventionally use dashes (Google treats dashes as word separators, underscores as word joiners in URLs).
Does this affect underscores that already exist in the text?
No. Only space characters are converted. Existing underscores remain unchanged. To also merge existing underscores with new ones, use the text cleaning tools.
Can I convert underscores back to spaces?
This tool does spaces→underscores only. For the reverse, use a find-and-replace with _ as search and (space) as replace, or use the regex-replace tool.