4

ASCII Character: Four

ASCII Code 52 · Unicode U+0034 · Hex 0x34

four 4

About the Four 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.

Encoding Details

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

Source Code Examples

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

Navigate

Copied!