4

ASCII Code 52

Four

About This Character

ASCII code 52 (0x34) represents the Four character "4". The digit "4" has ASCII code 52. The digits 0–9 occupy consecutive ASCII codes 48–57, which makes numeric conversion straightforward: subtracting 48 (or 0x30) from any digit character’s ASCII code gives its numeric value. The printable ASCII characters (codes 32–126) include the space, digits, uppercase and lowercase Latin letters, and common punctuation symbols. These 95 characters form the foundation of text representation in virtually all computing systems and are universally supported across all character encodings, programming languages, and operating systems.

Character Encoding

Decimal 52
Octal 064
Hexadecimal 0x34
Binary 00110100
HTML Code 4
HTML Entity
Unicode U+0034
Unicode Name DIGIT FOUR
URL Escape %34
Quoted-Printable 4
UTF-8 (Hex) 34
Category Printable — Digits

How to Type in Code

JavaScript
// Character literal
let char = '4';
// Using char code
let char2 = String.fromCharCode(52);
// Unicode escape
let char3 = '\x34';
Python
# Character literal
char = '4'
# Using chr()
char = chr(52)
# Using ord() to get code
code = ord('4')  # Returns 52
HTML
<!-- Direct character -->
4
<!-- HTML entity (numeric) -->
&#52;
<!-- Hex entity -->
&#x34;
C#
// Character literal
char c = '4';
// Using cast
char c2 = (char)52;
// To get code from char
int code = (int)'4';  // Returns 52

See Also

Copied!