ASCII 8
BACKSPACE
Backspace moves the cursor or print position back one column.
This ASCII code is a control character and has no printable Unicode glyph.
ASCII values
- Mnemonic
- BS
- Decimal
- 8
- Hex
- 08
- Octal
- 010
- Binary
- 00001000
- Category
- Control character
Copy values
BS80801000001000Which bytes are in my log?
ASCII backspace (BS) occupies one byte, 08 in hex. The Mnemonic button above copies the two letters BS (42 53). To identify a backspace in a JavaScript string, paste this snippet into a browser console. It prints the UTF-8 bytes without asking the console to display the control character.
const hex = text => Array.from(new TextEncoder().encode(text),
byte => byte.toString(16).padStart(2, "0")).join(" ");
console.log(hex("A\bB")); // 41 08 42
console.log(hex("A\\bB")); // 41 5c 62 42
console.log(hex("␈")); // e2 90 88The first string contains A, BS and B. JavaScript reads the doubled backslash in the second string as one literal backslash, followed by a lowercase b. The last string contains the printable symbol ␈ (U+2408), which you might see in a diagram. Compare it with the text-to-code-points tool. The digit 8 also has its own code, hex 38.
Does backspace erase the previous letter?
A terminal that interprets BS can move the cursor left after writing A, then write B in the same cell. A file containing those three bytes still contains A. A text editor may handle the Backspace key as an editing command and remove a character without inserting a BS byte. When investigating a saved log, inspect its bytes before drawing conclusions from its appearance.
RFC 20, sections 2 and 5.2, gives the ASCII code table and defines the movement of the print position.