ASCII code for null character
0
Null — a control character, not printable
| Decimal | 0 |
| Hexadecimal | 0x00 |
| Octal | 0000 |
| Binary | 00000000 |
| HTML entity | � |
| String escape | \0 |
What it is
Represents nothing at all. C uses it to mark the end of a string, which is why a C string cannot contain one and why "null-terminated" is a phrase at all. Writing a NUL into text that later reaches C code is a classic source of silent truncation.
The full entry
ASCII 0 in full — the code point page, with what sits either side of it and how the character is encoded elsewhere.
Frequently asked questions
What is the ASCII code for null character?
The ASCII code for null character is 0 in decimal, 0x00 in hexadecimal and 0000 in octal.
What is null character in binary?
00000000 — eight bits, though ASCII only defines seven, so the top bit is always zero.
How do I write null character in a string?
Most languages accept the escape \0. Writing the raw character instead works in some contexts and breaks in others, which is what the escape exists to avoid.
Other characters
- ASCII code for start of heading — 1
- ASCII code for start of text — 2
- ASCII code for end of text — 3
- ASCII code for end of transmission — 4
- ASCII code for enquiry — 5
- ASCII code for acknowledge — 6
- ASCII code for bell — 7
- ASCII code for backspace — 8
- ASCII code for tab — 9
- ASCII code for newline — 10
- ASCII code for vertical tab — 11
- ASCII code for form feed — 12
Every character by name · The ASCII table · Text to binary converter