DevKits

ASCII 178

Superscript Two (²)

Latin-1 Supplement

Latin-1 character.

Common uses & context

Decimal 178 (0xB2) is Superscript Two, part of the Latin-1 Supplement (128–255). Latin-1 character. It renders as '²' and its binary byte is 10110010.

This is where single-byte ASCII ends and encoding matters. In Latin-1 (ISO-8859-1) '²' is the single byte 0xB2. In UTF-8 — today's default for the web — the same character is the multi-byte sequence 0xC2 0xB2. Treating a Latin-1 byte as UTF-8 (or vice versa) is the usual reason accented letters and symbols turn into mojibake like é or €. The Unicode code point is U+00B2, and in HTML you can write it as ² or ².

All encodings at a glance

Decimal178
Hexadecimal0xB2
Octal0262
Binary10110010
HTML numeric entity²
HTML named entity²
URL encoding%B2
UTF-8 bytes0xC2 0xB2

Code snippets

JavaScript

String.fromCharCode(178); // "²"
178.toString(16); // "b2"

Python

chr(178)           # control char ²
ord(chr(178))      # 178
hex(178)           # '0xb2'

HTML

&sup2;   <!-- named entity -->
&#178;   <!-- numeric entity -->

Programming notes

  • Single byte 0xB2 in Latin-1, but the multi-byte sequence 0xC2 0xB2 in UTF-8 — never assume one byte per character above code 127.
  • Unicode code point U+00B2; HTML entity &sup2;.
  • If '²' shows as mojibake, the encoding declared and the encoding used disagree — align both on UTF-8.

Unicode & UTF-8 note

In Unicode this is U+00B2. In UTF-8 it encodes to the byte sequence 0xC2 0xB2. In legacy Latin-1 (ISO-8859-1) it is a single byte 0xB2, which is why Latin-1 files often appear as mojibake when interpreted as UTF-8.

Frequently asked questions

What character is ASCII code 178?

ASCII code 178 is the character '²' (Superscript Two). In hexadecimal it is 0xB2, in octal 0262, and in binary 10110010.

What is 0xB2 in ASCII?

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

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

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

Is '²' part of standard ASCII?

No. Standard ASCII covers codes 0–127 only. '²' is code 178, part of the Latin-1 Supplement (128–255, sometimes called "extended ASCII"). It is a single byte 0xB2 in Latin-1 but a multi-byte sequence (0xC2 0xB2) in UTF-8.

Nearby codes

Encode & convert this character