DevKits

ASCII 42

Asterisk (*)

Printable ASCII

Asterisk / star. Multiplication, wildcards, pointer dereference (C), and emphasis (Markdown).

Common uses & context

The character '*' — Asterisk — has ASCII code 42 (0x2A), octal 0052, binary 00101010. Asterisk / star. Multiplication, wildcards, pointer dereference (C), and emphasis (Markdown).

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

All encodings at a glance

Decimal42
Hexadecimal0x2A
Octal0052
Binary00101010
HTML numeric entity*
URL encoding%2A
UTF-8 bytes0x2A

Code snippets

JavaScript

String.fromCharCode(42); // "*"
42.toString(16); // "2a"

Python

chr(42)           # '*'
ord(chr(42))      # 42
hex(42)           # '0x2a'

HTML

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

Programming notes

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

ASCII code 42 is the character '*' (Asterisk). In hexadecimal it is 0x2A, in octal 0052, and in binary 00101010.

What is 0x2A in ASCII?

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

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

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

Nearby codes

Encode & convert this character