DevKits

ASCII 40

Left Parenthesis (()

Printable ASCII

Left parenthesis. Opens a group in expressions and function calls.

Common uses & context

The character '(' — Left Parenthesis — has ASCII code 40 (0x28), octal 0050, binary 00101000. Left parenthesis. Opens a group in expressions and function calls.

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 %28), or in HTML. Knowing its exact code point (40) helps when you filter, validate, or sanitize input byte by byte.

All encodings at a glance

Decimal40
Hexadecimal0x28
Octal0050
Binary00101000
HTML numeric entity(
URL encoding%28
UTF-8 bytes0x28

Code snippets

JavaScript

String.fromCharCode(40); // "("
40.toString(16); // "28"

Python

chr(40)           # '('
ord(chr(40))      # 40
hex(40)           # '0x28'

HTML

&#40;   <!-- numeric entity (no named entity for this character) -->

Programming notes

  • Code 40 (0x28); URL-encoded form%28.
  • In HTML the numeric entity is &#40;.
  • 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 40?

ASCII code 40 is the character '(' (Left Parenthesis). In hexadecimal it is 0x28, in octal 0050, and in binary 00101000.

What is 0x28 in ASCII?

Hexadecimal 0x28 equals decimal 40, which is the character '(' (Left Parenthesis). To convert hex to ASCII yourself, read the two hex digits as a base-16 number (0x28 = 40) and look up that code point.

How do I write the character with code 40 in code?

In JavaScript use String.fromCharCode(40); in Python use chr(40); in HTML use the numeric entity &#40;. In a URL it is percent-encoded as %28, and in UTF-8 it is stored as the byte sequence 0x28.

Nearby codes

Encode & convert this character