A literal \n becomes a real new line when escaped-to-actual mode replaces the two visible characters, backslash and n, with one LF line-feed character.

The key distinction is representation. The text First line\nSecond line contains a backslash and the letter n between the phrases, so it appears on one physical line when the sequence is still visible. After conversion, “First line” appears on one row of the preview and “Second line” appears on the next. This is the simplest \n to new line example: the words stay in place, while the marker changes into a real line boundary.

convert \n to new line example
Convert \n to New Line: One Worked Example

A Minimal \n to New Line Example

An actual newline is a boundary that controls text layout. A literal \n is two printable characters: backslash and n. The converter does not treat those two concepts as interchangeable. Instead, you choose a mode that says whether the input contains actual boundaries or visible escape text, and the output applies that rule consistently.

For the example above, the input can be copied as one line with the visible sequence between the phrases. In escaped-to-actual mode, the result is the same words separated by one LF newline. The preview is preformatted, so the first phrase appears on one row and the second appears on the next; in the downloadable TXT, those rows are stored as an actual LF character rather than printable backslash-n text.

The input remains separate from the generated output. The converter never overwrites the original textarea, so you can compare the source with the result. For this task, do not replace the visible sequence with Enter before conversion: Enter would create an actual boundary and change which mode is appropriate.

Convert the Literal \n Example

Use the escaped-to-actual workflow when the source contains visible newline markers that should become real lines.

  1. Paste or type the source text. Use a small test first, such as First line\nSecond line. Confirm that the backslash and n appear as two characters and that the phrases have not already been separated by an actual line break.
  2. Choose escaped-to-actual mode. This is the mode for visible escape sequences, not for actual CR, LF, or Windows CRLF boundaries. Do not choose actual-to-space, because that mode replaces real boundaries with spaces rather than decoding visible sequences.
  3. Run Convert. The converter recognizes the literal sequences \r\n, \n, and \r. It checks the combined CRLF spelling first and replaces every recognized sequence with one LF newline.
  4. Inspect the preview for exact placement. Confirm that each marker became a line boundary and that no extra rows or spaces appeared. Because the preview preserves whitespace, real newlines create separate rows while any remaining visible escape characters stay visible.
  5. Download the UTF-8 TXT result. The generated file contains no byte-order mark, and its bytes match the string shown in the preview. If you later edit the input or change the mode, the previous result is cleared and its download is invalidated, preventing an old file from being mistaken for the current output.

The converter accepts up to 1,000,000 characters so the browser can transform and render the text responsively. Empty input produces a visible error. For a quick verification, use a short example, confirm the placement in the preview, and only then run the full input.

Choose the Representation Your Text Needs

The Line Break Converter exposes three explicit modes. Choose based on the representation already present and the representation required by the destination.

Mode Recognized input Exact output
actual-to-escaped Actual Windows CRLF, lone CR, or lone LF boundaries One literal backslash followed by n for each boundary
escaped-to-actual Literal backslash-r-backslash-n, backslash-n, or backslash-r sequences One LF newline for each recognized sequence
actual-to-space Actual Windows CRLF, lone CR, or lone LF boundaries One ordinary space for each boundary

Use actual-to-escaped when multiline text must become a single visible line for documentation or controlled string preparation. A CRLF pair counts as one boundary, so it produces one \n, not two. Existing printable backslashes elsewhere in the text are left alone.

Use escaped-to-actual for copied JSON-like strings, log output, or configuration values containing visible newline markers. This mode can prepare those markers for a destination that expects real lines, but it does not make the surrounding syntax valid; check quoting after conversion. If the destination instead needs one continuous line with no actual boundary, actual-to-space is the relevant mode.

Space mode performs a literal boundary replacement. It does not collapse consecutive spaces, trim the result, or infer sentence punctuation. Two consecutive line boundaries therefore become two spaces, including when those boundaries represent blank lines.

Handle CRLF, Backslashes, and Language Rules

Windows CRLF needs special attention because it contains two line-ending characters. In actual-to-escaped mode, the converter recognizes the pair first and treats it as one boundary. Lone CR and lone LF boundaries are also recognized. In escaped-to-actual mode, the literal \r\n sequence is likewise matched before the shorter alternatives. Every created boundary is an LF, and the tool does not promise to preserve a mixture of original line-ending styles.

The converter matches only the documented visible sequences. It does not calculate programming-language escape depth. For example, several backslashes before an n are not interpreted as though they were inside a quoted string in a particular language. The combination of visible characters is either one of the three recognized sequences or it is left untouched.

That rule keeps the operation predictable, but it also defines its limit. The tool is not a parser for JSON, JavaScript, CSV, HTML, Markdown, shell syntax, or quoted string escaping. Language-specific escape rules are contextual; MDN's escape-sequence reference is a useful reference when checking how a destination interprets such text.

Verify the Result in Its Destination

Inspect the result where it will actually be used. A real newline inside a quoted source-code string can be invalid unless that syntax permits it, and a converted string may need additional escaping. Escaped-to-actual mode creates a real LF; it does not preserve a quoted-string representation automatically. If the destination needs the visible form instead, convert actual line boundaries with actual-to-escaped mode rather than running escaped-to-actual in the first place.

The preview preserves exact whitespace, while visual wrapping of a long row does not insert newline bytes into the download. Tabs are not converted, the tool does not add HTML br tags, and it does not wrap text to a width. It also does not remove all whitespace, collapse every kind of spacing, or infer missing punctuation. Those are separate cleanup tasks.

Conversion, preview, and TXT download creation run locally in the browser, with no upload or network reference data. The original input remains available for comparison, while the download is plain UTF-8 text without a byte-order mark. Review the destination-specific quoting after downloading rather than assuming a representation change also handled a language's syntax.

If the real goal is to delete line breaks instead of changing their representation, use Line Break Remover. For broader horizontal-spacing, blank-line, or general whitespace cleanup, use Whitespace Remover.

For a deeper look, see Line Break Remover Example: 3 Modes Compared.

For a deeper look, see Line Counter Cheat Sheet: Boundaries and Blank Lines.