ASCII 45
Hyphen-Minus (-)
Printable ASCII
Hyphen / minus. Subtraction, negative numbers, and word separator in kebab-case slugs.
Common uses & context
The character '-' — Hyphen-Minus — has ASCII code 45 (0x2D), octal 0055, binary 00101101. Hyphen / minus. Subtraction, negative numbers, and word separator in kebab-case slugs.
Punctuation and symbol codes carry the most syntactic weight per byte in programming: a single '-' can change how a parser reads an entire expression. When '-' needs to appear as literal data rather than syntax, you often have to escape it — in string literals, in regular expressions, in URLs (where it becomes %2D), or in HTML. Knowing its exact code point (45) helps when you filter, validate, or sanitize input byte by byte.
All encodings at a glance
| Decimal | 45 |
| Hexadecimal | 0x2D |
| Octal | 0055 |
| Binary | 00101101 |
| HTML numeric entity | - |
| URL encoding | %2D |
| UTF-8 bytes | 0x2D |
Code snippets
JavaScript
String.fromCharCode(45); // "-"
45.toString(16); // "2d"Python
chr(45) # '-'
ord(chr(45)) # 45
hex(45) # '0x2d'HTML
- <!-- numeric entity (no named entity for this character) -->Programming notes
- ▸Code 45 (0x2D); URL-encoded form%2D.
- ▸In HTML the numeric entity is -.
- ▸When used as literal data in regex or strings, '-' usually needs escaping — check the rules for your language.
Frequently asked questions
What character is ASCII code 45?
ASCII code 45 is the character '-' (Hyphen-Minus). In hexadecimal it is 0x2D, in octal 0055, and in binary 00101101.
What is 0x2D in ASCII?
Hexadecimal 0x2D equals decimal 45, which is the character '-' (Hyphen-Minus). To convert hex to ASCII yourself, read the two hex digits as a base-16 number (0x2D = 45) and look up that code point.
How do I write the character with code 45 in code?
In JavaScript use String.fromCharCode(45); in Python use chr(45); in HTML use the numeric entity -. In a URL it is percent-encoded as %2D, and in UTF-8 it is stored as the byte sequence 0x2D.