- is the Unicode character HYPHEN-MINUS, code point U+002D (decimal 45) in the Basic Latin block, added in Unicode 1.1. In HTML write -, and in UTF-8 it is the single byte 2D.
Codes
| Where | How to write it |
|---|---|
| Code point | U+002D |
| Decimal | 45 |
| UTF-8 bytes | 2D |
| UTF-16 (big-endian) | 002D |
| UTF-32 | 0000002D |
| HTML decimal | - |
| HTML hex | - |
| CSS | \2D |
| JavaScript | \u002D |
| JSON | \u002D |
| Python | \u002D |
| Python by name | \N{HYPHEN-MINUS} |
| Java, C# | \u002D |
| Rust, Swift | \u{2D} |
| Go, C, C++ | \u002D |
| URL (percent-encoded) | %2D |
JavaScript and JSON strings store text as UTF-16, so this character is one code unit long. Python 3 strings count code points, so its length there is 1.
Properties
| Property | Value |
|---|---|
| Name | HYPHEN-MINUS |
| Code point | U+002D (decimal 45) |
| Block | Basic Latin (U+0000–U+007F) |
| General category | Pd: Dash punctuation |
| Script | Common |
| Bidirectional class | ES: European number separator |
| Mirrored in right-to-left text | No |
| First in Unicode version | 1.1 |
Nearby in Basic Latin
- % U+0025 Percent Sign
- & U+0026 Ampersand
- ' U+0027 Apostrophe
- ( U+0028 Left Parenthesis
- ) U+0029 Right Parenthesis
- * U+002A Asterisk
- + U+002B Plus Sign
- , U+002C Comma
- . U+002E Full Stop
- / U+002F Solidus
- 0 U+0030 Digit Zero
- 1 U+0031 Digit One
- 2 U+0032 Digit Two
- 3 U+0033 Digit Three
- 4 U+0034 Digit Four
- 5 U+0035 Digit Five
All 128 characters: Basic Latin.
Official reference
Questions people ask
- What is the HTML code for -?
- Use - (decimal) or - (hex).
- What is the UTF-8 encoding of U+002D?
- 2D (hex), 1 byte. In a URL it is %2D.
- How do I write U+002D in JavaScript or Python?
- JavaScript: \u002D. Python: \u002D.
Source
Unicode Character Database 18.0.0 (Unicode License v3); HTML entity names from the WHATWG HTML Standard (CC BY 4.0). The encodings above are computed from the code point and checked against Python's encoders. How the character looks depends on your fonts.
Legal entity
Devansh Yadav
Moradabad, Uttar Pradesh
Governing law: Courts at Moradabad, Uttar Pradesh
Phone: +91 8433475698
Legal: legal@analyzeit.in