Pi (π) in HTML
Pi is the sixteenth Greek letter, written Π and π. The capital is at U+03A0 and the small letter at U+03C0, which names the circle constant.
At a glance
- Character
- Π π
- Named entity
- Π π
- Decimal reference
- Π π
- Hex reference
- Π π
- Unicode code point
- U+03A0, U+03C0
- Unicode name
- GREEK CAPITAL LETTER PI, GREEK SMALL LETTER PI
- In the entity reference
- Greek
In detail
The small pi is the ratio of a circle's circumference to its diameter, and its status as a constant is what makes it unusual among Greek letters: everywhere else in this cluster the letter names a variable whose value depends on the problem, while pi is the same number in every equation it appears in.
In code, never write it out as a literal. Every language ships the constant at the precision of its floating point type, and a hand typed 3.14159 is both less accurate and impossible to audit. Deriving related values from the constant rather than typing them, a half turn or a quarter turn for instance, keeps the precision consistent through a calculation.
The capital pi is the product operator in mathematical notation, the multiplicative counterpart of the summation sigma. It has its own code point for that role, at U+220F, distinct from the Greek capital letter. As with sigma, they render almost identically and are not the same character, so an operator written with the letter will not match a search for the operator.
A separate glyph exists at U+03D6, the pi symbol, drawn in a curlier form used in some mathematical traditions. It is a different code point rather than a font feature, and its coverage is thinner, so it is worth avoiding unless a specific typographic house style calls for it.
Examples
<p>C = 2πr</p>
<p>A = πr²</p>
<p>A full turn is 2π radians.</p>const area = Math.PI * r * r;
const quarterTurn = Math.PI / 2;
// avoid
const worse = 3.14159 * r * r;Things that catch people out
- The Greek capital pi and the product operator at U+220F look the same and are different characters. Use the operator in formulas.
- A hard coded decimal approximation loses precision silently and cannot be traced back through a calculation.
- Degrees and radians both describe a full turn. Mixing the two in one expression is the most common source of a result that is off by a constant factor.
Try it: HTML Entity Reference
Search 152 entities across 9 categories, switch the copy format between the character, the name, the decimal form and the hex form, and copy in one click.
HTML Entity Reference
LOCAL · Browser-OnlySearchable reference of 150+ HTML entities with one-click copy in any format
152 entities across 9 categories
Commonly Used
→Arrows(13)
±Math(35)
$Currency(8)
…Punctuation(21)
©Symbols(24)
πGreek(30)
½Fractions(6)
●Geometric(7)
æLatin Special(8)
Click any entity card to copy it in your chosen format. All data is embedded in the page and works offline.
Related HTML entities
All html entities →Theta (θ) in HTML
The Greek letter theta at U+0398 and U+03B8, its entity forms, its role as the default angle variable, and what big theta asserts about an algorithm.
Sigma (σ) in HTML
The Greek letter sigma at U+03A3 and U+03C3, its entity forms, the summation operator it is confused with, and the final sigma used at the end of a word.
Mathematical operator entities: sets, logic and calculus
Named entities for summation, integral, partial differential, set membership, union, intersection and the logical connectives, with their code points.
Phi (φ) in HTML
The Greek letter phi at U+03A6 and U+03C6, its entity forms, the loopy and straight glyph variants, and the golden ratio it conventionally names.
Omega (ω) in HTML
The Greek letter omega at U+03A9 and U+03C9, its entity forms, the separate ohm sign that normalises onto it, and its use for angular frequency.
Non-breaking space ( ) in HTML
The no-break space at U+00A0, what it prevents beyond line breaking, why it defeats site search, and the CSS properties that do the job better.
Tools for this
- HTML Entity Reference Free online HTML entity reference - search and copy HTML entities with live preview
- HTML Entity Encoder Free online HTML entity encoder - encode or decode HTML entities to prevent XSS and display issues