# Escape Character

> A mark that changes what the next letter means. Most often it is a backslash.

**Field:** Software Development  
**Category:** Files & Formats  
**Also known as:** Escape Sequence, Backslash Escape, Escaping

## Think of it like

Think of it like a secret signal to a friend. It says the next word does not mean what it looks like.

## Definition

An escape character tells a program to treat the next character in a special way. In most languages it is the backslash. A quote inside text would end the text too soon, so you write \" instead. Some pairs stand for hidden characters, like \n for a new line and \t for a tab. To write a real backslash, you type two of them.

## Example

Jack writes a Windows path in his code as C:\\Users\\Jack. Each double backslash prints as a single one.

## Example code

```javascript
console.log("She said \"hi\"\nBye")
// She said "hi"
// Bye
```

The backslash lets a quote sit inside the text, and it turns n into a new line.

## Why it matters

Escaping is how text can hold the characters that would break it. Getting it wrong causes many bugs and some attacks.

## Common mistake

Forgetting to escape a quote inside a string. The text ends too soon, and the rest becomes broken code.

## Three principles

- **Changes the next one.** The character after it is special.
- **Mostly a backslash.** Most languages use the backslash.
- **Hidden characters.** A backslash and n make a new line.

## Related terms

- [String](https://learn.benibix.com/term/development/string)
- [Regular Expression (Regex)](https://learn.benibix.com/term/development/regular-expression)
- [Line Ending](https://learn.benibix.com/term/development/line-ending)
- [URL Encoding (Percent-Encoding)](https://learn.benibix.com/term/development/url-encoding)
- [Cross-Site Scripting (XSS)](https://learn.benibix.com/term/development/cross-site-scripting)

## Taught in

- [Escapes, Base64, URL Encoding](https://learn.benibix.com/learn/development-formats/escapes-base64-url-encoding): File Formats, 9/11

![Three rows, each with a rule, what you mean, and what is stored. Line ending: Hello then a new line is stored as Hello backslash n on Linux and macOS, and Hello backslash r backslash n on Windows. Escape character: a quote inside quotes is typed with a backslash before each inner quote. URL encoding: fish and chips in a link becomes fish%20%26%20chips.](https://learn.benibix.com/diagrams/dev2-escapes.svg)

---

Source: https://learn.benibix.com/term/development/escape-character
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-18
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
