텍스트
String Escape
텍스트를 문자열 리터럴로 이스케이프하여(따옴표, 백슬래시, 제어 문자) 코드에 붙여넣을 수 있게 하거나, 다시 언이스케이프합니다.
To put text containing quotes, line breaks, or backslashes inside a string literal in code, those characters need escaping — otherwise they'll end the string early or get misinterpreted. This tool escapes and unescapes text for a specific syntax.
How to use it
- Escape: paste text and pick a target context (a JS string, JSON, shell, etc.) and special characters get replaced with the matching escape sequences.
- Unescape: paste an already-escaped string to get the original text back.
- Different contexts escape the same character differently — make sure you've picked the mode matching where the text will actually be inserted.
Common uses
- Inserting multi-line text or text with quotes into a code variable without manually placing backslashes.
- Preparing a string for a shell command, where quotes and special characters can break execution.
- Unescaping a string copied from logs or a JSON response to read the original text.
Things to keep in mind
The same character (a double quote, for example) is escaped differently depending on context — a JS string, JSON, and a shell each have their own syntax and their own set of special characters.
Double-escaping (escaping already-escaped text) is a common mistake when passing data through multiple layers, like JSON nested inside a shell command.
자주 묻는 질문
정확히 어떤 문자가 이스케이프되나요?
따옴표(선택한 스타일에 맞는 큰따옴표, 작은따옴표, 백틱), 백슬래시, 줄바꿈 같은 제어 문자가 이스케이프되며, 필요하면 비-ASCII 문자를 \uXXXX 유니코드 이스케이프로 변환하는 옵션도 켤 수 있습니다.
이스케이프와 언이스케이프 모드의 차이는 무엇인가요?
이스케이프 모드는 원본 텍스트를 코드에 바로 붙여넣을 수 있는 문자열 리터럴로 변환하고, 언이스케이프 모드는 이미 이스케이프된 문자열을 원래 텍스트로 복원합니다.
입력한 텍스트가 서버에 전송되나요?
아니요. 모든 변환은 브라우저 안에서 자바스크립트로 처리되며 텍스트는 서버로 전송되지 않습니다.
텍스트가 여러 맥락을 연속으로 거쳐 갈 때는 어떻게 해야 하나요?
올바른 순서로 이스케이프해야 합니다: 먼저 안쪽 맥락(예: JSON)을, 그다음 바깥쪽 맥락(예: 그 JSON이 삽입되는 셸 명령어)을 처리합니다. 순서를 뒤바꾸거나 한 단계를 빠뜨리는 것이 "제대로 이스케이프했는데도" 실제로는 깨지는 문자열의 흔한 원인입니다.
같은 따옴표인데 왜 맥락마다 이스케이프 방식이 다른가요?
각 맥락(JS 문자열, JSON, 셸, 정규 표현식)마다 고유한 특수 문자 집합과 고유한 이스케이프 방식을 가진 자기만의 문법이 있기 때문입니다. 따라서 올바른 이스케이핑은 텍스트 자체가 아니라 그 텍스트가 정확히 어디에 삽입되는지에 달려 있습니다.