Skip to content
ASCII World
-

Hyphen-minus

PrintableASCII 45 | Hex 0x2D | U+002D
ASCII 45 pulls double duty as both the hyphen in text and the minus sign in arithmetic. Unicode assigns separate code points to the hyphen (U+2010), minus sign (U+2212), and en dash (U+2013), but the ASCII hyphen-minus remains the standard in source code and command-line flags. In regular expressions, a hyphen inside a character class like [a-z] defines a range, so placing a literal hyphen requires putting it first or last in the class. CSS property names use hyphens as word separators (font-size), while JavaScript equivalents use camelCase (fontSize).

ASCII Code

Decimal
45
Hexadecimal
0x2D
Octal
55
Binary
0010 1101
URL Escape
%2D

Unicode

Code Point
U+002D
Escape
\u002d
UTF-8 Hex
0x2D
UTF-8 Binary
00101101
UTF-16
0x002D
UTF-32
0x0000002D

HTML Entities

Numeric
-
Hex
-

How to Type

Windows Alt CodeAlt + 45
HTML Entity
-
Unicode InputU+002D

Source Code Representations

C / Java
"\u002D"
CSS
\002D
JavaScript
"\u002D"
Perl
\x{002D}
Python 2
u"\u002D"
Python 3
\u002D
Ruby
\u{002D}

Frequently Asked Questions

What is ASCII code 45?
ASCII code 45 represents the Hyphen-minus character. In hexadecimal it is 0x2D, in binary 0010 1101, and in octal 55. It is a printable character that appears as "-" in text.
How do I type ASCII 45 on a keyboard?
On Windows, hold Alt and type 45 on the numeric keypad. On Mac, you can use the Character Viewer (Edit > Emoji & Symbols). In HTML, use the entity - or -.