2

ASCII Code 50

Two

About This Character

ASCII code 50 (0x32) represents the Two character "2". The digit "2" has ASCII code 50. 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 50
Octal 062
Hexadecimal 0x32
Binary 00110010
HTML Code 2
HTML Entity
Unicode U+0032
Unicode Name DIGIT TWO
URL Escape %32
Quoted-Printable 2
UTF-8 (Hex) 32
Category Printable — Digits

How to Type in Code

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

See Also

Copied!