Newline Escape Converter

Convert between real line breaks and escaped newline sequences. Toggle between Escape and Unescape modes. Perfect for JSON strings. Free.

Convert real newlines → \n sequences

Text with Newlines INPUT
Escaped Output OUTPUT

How to Use

  1. 1 In 'Escape' mode, paste text with real newlines and click Convert to replace them with \n escape sequences.
  2. 2 In 'Unescape' mode, paste text containing \n sequences and click Convert to restore real line breaks.
  3. 3 Copy the result to use in JSON strings, config values, or wherever escaped newlines are needed.

Use Cases

JSON String Preparation

Escape multi-line text before embedding it as a value in JSON, where literal newlines are invalid.

Log File Processing

Unescape log entries or error messages stored as single-line strings to readable multi-line format.

API Payload Debugging

Quickly convert between escaped and real newlines when building or inspecting API request bodies.

FAQ

The Escape mode converts real LF (\n) to \\n and CRLF (\r\n) to \\r\\n. The Unescape mode reverses both conversions.

JSON specification does not allow literal newlines inside string values. Multi-line text must use \n escape sequences instead of actual line breaks.

Yes. Both LF (Unix) and CRLF (Windows) newlines are handled in Escape mode. Unescape converts both \\n and \\r\\n back to real newlines.

Related Tools