DevKits

ASCII 24

Cancel (CAN)

Control character

Cancels the current escape sequence in ANSI terminal codes.

Common uses & context

Decimal 24 (0x18) is the Cancel control character — one of the 33 non-printing codes in the C0 control block (0–31 plus DEL at 127). Control characters were designed to command teletype and terminal hardware rather than to represent visible glyphs, so CAN produces no letter, digit, or symbol on screen. Its8-bit binary form is 00011000 and its octal value is 0030.

Cancels the current escape sequence in ANSI terminal codes.

BecauseCAN is invisible, it is easiest to work with by its numeric code. In most languages you can produce it with the escape or code-point form shown below, and detect it by comparing a byte against 24 (0x18). When it turns up unexpectedly in text — pasted from a terminal, a legacy file, or a binary blob — it is usually the cause of "invisible character" bugs that break parsing or comparisons.

All encodings at a glance

Decimal24
Hexadecimal0x18
Octal0030
Binary00011000
HTML numeric entity
URL encoding%18
UTF-8 bytes0x18

Code snippets

JavaScript

String.fromCharCode(24); // "CAN"
24.toString(16); // "18"

Python

chr(24)           # control char CAN
ord(chr(24))      # 24
hex(24)           # '0x18'

HTML

&#24;   <!-- numeric entity (no named entity for this character) -->

Programming notes

  • Detect it by numeric comparison: byte === 24 (0x18). It has no printable glyph to match on.
  • Control characters below 32 are stripped or rejected by many text validators — check for them when sanitizing user input.
  • In a hex dump CAN shows as 18; in a "cat -v" style view it may appear as a caret sequence.

Frequently asked questions

What character is ASCII code 24?

ASCII code 24 is Cancel (CAN), a non-printing control/whitespace character. In hexadecimal it is 0x18 and in binary 00011000. It has no visible glyph — it controls formatting or hardware instead of drawing a symbol.

What is 0x18 in ASCII?

Hexadecimal 0x18 equals decimal 24, which is theCancel control character (CAN). To convert hex to ASCII yourself, read the two hex digits as a base-16 number (0x18 = 24) and look up that code point.

How do I write the character with code 24 in code?

In JavaScript use String.fromCharCode(24); in Python use chr(24); in HTML use the numeric entity &#24;. In a URL it is percent-encoded as %18, and in UTF-8 it is stored as the byte sequence 0x18.

Is ASCII 24 (CAN) printable?

No. CAN (code 24) is a control character with no visible glyph. It instructs software or hardware rather than displaying a symbol, which is why it often appears as an invisible or replacement character when it leaks into ordinary text.

Nearby codes

Encode & convert this character