Skip to content
UniKit

Escape sequence converter

Turn literal escape sequences such as \n, \r\n, \t and \\ back into real characters, or escape real newlines and tabs into literals so multi-line content fits into a single JSON string or spreadsheet cell.

Runs in your browserEvery computation happens in your browser — your data never leaves this device.

Text

Only literal escape sequences are replaced; real line breaks already in the text are left alone.

Escape real line breaks, tabs and backslashes back to \n, \t and \\ so multi-line content becomes one line.

For example \u4e2d → 中 and \u{1F600} → 😀; code points outside the Unicode range stay as they are.

Escape sequences to handle

Converted text

Updates live with your input and options; ready to copy.

Enter text to see the converted result

Replacements: 0

Breakdown: Nothing replaced yet

What this tool does

  • Decode \n and \t copied out of logs, API responses or JSON back into real line breaks and tabs
  • Flatten multi-line text into one line by escaping real line breaks as \n for JSON strings or single-line database fields
  • Decode only specific sequences, for example turning \u4e2d style Unicode escapes into real characters

Example

Input

第一行\n第二行\t结束

Output

第一行
第二行	结束

The example turns the literal \n into a real line break and \t into a tab; both boxes look the same on screen, the characters differ.

Frequently asked questions

Are real line breaks already in the text treated as \n?

No. Decoding only matches the literal "backslash + letter" form; real line breaks and tabs that are already there stay untouched, so mixed content survives.

Does reverse mode also change my own backslashes?

Yes. In reverse mode a real backslash becomes two backslashes (\ → \\) and a real line break becomes \n, which keeps the result parseable as escaped text. If you only need line breaks, untick the backslash entry in the sequence list.

Are \u4e2d and \x41 style escapes supported?

Yes, but you have to tick "also decode \uXXXX / \u{...} / \xNN". They are off by default because plain prose often contains words that start with \u. Values above U+10FFFF or malformed escapes are left as they are.

What are the rarely used sequences like \0, \a and \b for?

They map to NUL, bell and backspace, which show up in C / Java / Python string literals. They are handled by default; untick them in the sequence list when you do not need them.

Keywords:escape sequence converterunescape texttxt-ln

Related tools