首页
Tom Utilities

JavaScript 转义 / 反转义

HTML、CSS 与 JavaScript

将文本转义为安全的 JavaScript 字符串字面量,或解码已转义的字符串。

输入

结果

使用方法

Escaping JavaScript strings

Encode escapes quotes, backslashes and control characters. Decode reverses the process.

  1. Paste text or a literal.
  2. Press Encode or Decode.
  3. Copy the result.

常见问题

Which quote style is used?

Single quotes are used by default and inner quotes are escaped accordingly.

Does it handle unicode?

Yes, non ASCII characters are preserved or escaped using unicode escape sequences.