Newline Converter
Convert line endings online — switch between Windows (CRLF), Unix/Linux/macOS (LF), and classic Mac (CR), or turn newlines into \n escape sequences, spaces, or HTML <br> tags. Detects the current line-ending style and converts everything in your browser.
ToolsSoup's Newline Converter is a free online tool that changes the line endings in any text with one click. Paste your content and convert between Windows line endings (CRLF, \r\n), Unix/Linux/macOS line endings (LF, \n), and classic Mac line endings (CR, \r). It can also turn real line breaks into literal \n escape sequences, replace them with single spaces, or wrap them in HTML <br> tags. The tool automatically detects the current line-ending style — including mixed files — and shows the line and character counts of the result. Everything runs in your browser: no uploads, no sign-up, and your text never leaves your device.
What is a newline converter?
A newline converter changes the invisible end-of-line characters that mark where one line stops and the next begins. Different operating systems use different markers: Windows uses a carriage return plus a line feed (CRLF, \r\n), Unix, Linux, and modern macOS use a single line feed (LF, \n), and very old Mac systems used a lone carriage return (CR, \r). These characters are invisible on screen, but they matter to programs, version control, and shell scripts. This tool rewrites every line ending in your text to the format you choose, so files behave consistently no matter where they were created.
How to convert line endings
Switching line endings with ToolsSoup takes only a few seconds:
- Type directly into the text box or paste the text whose line endings you want to change.
- Choose a target format — LF for Unix/Linux/macOS, CRLF for Windows, CR for classic Mac, or one of the extras like \n escapes, spaces, or HTML <br> tags.
- Click Convert, check the detected source format and counts, then click Copy result to grab your converted text.
CRLF vs. LF vs. CR — what's the difference?
CRLF (\r\n) is the Windows convention and pairs a carriage return with a line feed. LF (\n) is a single line feed and is the standard on Unix, Linux, and macOS, as well as the default in most programming languages and Git. CR (\r) is a lone carriage return used by classic Mac OS before OS X and is rarely seen today. Mixing these within one file causes the classic problems: a script that fails with a confusing error, a diff that marks every line as changed, or text that displays with extra blank lines. Converting everything to a single, consistent style fixes those issues.
When should I convert newlines?
Convert to LF when a shell script, Makefile, or config file edited on Windows refuses to run on Linux or macOS, or to keep a Git repository consistent. Convert to CRLF when a Windows program — such as Notepad or a legacy editor — shows your text as one long line because it only understands CRLF. Use the \n escape option to paste a multi-line block into a JSON string or source-code literal, the single-space option to flatten text onto one line, and the <br> option to move plain text into HTML while preserving its line breaks.
Why use this newline converter?
- Convert between Windows (CRLF), Unix/Linux/macOS (LF), and classic Mac (CR) line endings in one click.
- Automatically detect the current line-ending style, including mixed files.
- Turn real line breaks into literal \n escape sequences for JSON and source code.
- Replace newlines with single spaces to flatten text onto one line.
- Wrap line breaks in HTML <br> tags to move plain text into web pages.
- See the resulting line and character counts, with the output ready to copy.
- Runs entirely in your browser — your text is never uploaded.
Frequently asked questions
How do I convert Windows line endings to Unix?
Paste your text, choose Unix / Linux / macOS (LF) as the target, and click Convert. Every CRLF (\r\n) becomes a single LF (\n), giving you Unix-style line endings ready to copy.
What is the difference between CRLF and LF?
CRLF is a carriage return followed by a line feed (\r\n) and is used by Windows. LF is a single line feed (\n) used by Unix, Linux, macOS, Git, and most programming languages. Mixing them can break scripts and make diffs noisy, so converting to one consistent style avoids those problems.
Can it detect which line endings my text uses?
Yes. When you convert, the tool reports the detected source format — CRLF, LF, CR, Mixed, or None — so you can confirm what the original text contained before it was converted.
Can it turn line breaks into \n escape sequences?
Yes. Choose the Literal \n escape sequence option and each line break becomes the two characters backslash-n, which is handy when pasting multi-line text into a JSON string or a source-code literal.
Can it convert newlines to spaces or HTML <br> tags?
Yes. Pick Single space to flatten the text onto one line, or HTML <br> tags to wrap each line break in a <br> so the line breaks survive when the text is rendered as HTML.
Is my text private?
Absolutely. All conversion happens locally in your browser using JavaScript, so the text you enter is never sent to or stored on any server.