DevKits

ASCII 39

Apostrophe (')

Printable ASCII

Apostrophe / single quote. Wraps string literals in many languages. Escaped as \' when nested.

Common uses & context

The character ''' — Apostrophe — has ASCII code 39 (0x27), octal 0047, binary 00100111. Apostrophe / single quote. Wraps string literals in many languages. Escaped as \' when nested.

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 %27), or in HTML (where it is written'). Knowing its exact code point (39) helps when you filter, validate, or sanitize input byte by byte.

All encodings at a glance

Decimal39
Hexadecimal0x27
Octal0047
Binary00100111
HTML numeric entity'
HTML named entity'
URL encoding%27
UTF-8 bytes0x27

Code snippets

JavaScript

String.fromCharCode(39); // "'"
39.toString(16); // "27"

Python

chr(39)           # '''
ord(chr(39))      # 39
hex(39)           # '0x27'

HTML

&apos;   <!-- named entity -->
&#39;   <!-- numeric entity -->

Programming notes

  • Code 39 (0x27); URL-encoded form%27.
  • In HTML write it as &apos; (named) or &#39; (numeric) to avoid it being parsed as markup.
  • 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 39?

ASCII code 39 is the character ''' (Apostrophe). In hexadecimal it is 0x27, in octal 0047, and in binary 00100111.

What is 0x27 in ASCII?

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

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

In JavaScript use String.fromCharCode(39); in Python use chr(39); in HTML use the numeric entity &#39; or the named entity &apos;. In a URL it is percent-encoded as %27, and in UTF-8 it is stored as the byte sequence 0x27.

Nearby codes

Encode & convert this character