# How can I add the mathematical symbol for 'power' (like X ^ 2) to a question?

I'm asking a simple question on Stack Overflow. The question is somehow related to mathematics. Is there a way to show the mathematical symbol for power (X^Y) appropriately?

Edit: The following question What HTML tags are allowed on Stack Exchange sites? provides a complete reference.

• Are you talking about a MathJax approach? Then you would use $x^y$ on sites that support it (like Mathematics). – Werner Mar 26 '14 at 14:34
• – yannis Mar 26 '14 at 14:39

On the sites that don't support MathJax, you can use <sup>.

x<sup>2</sup>


will produce: x2

• Does it work in a comment? x<sup>2</sup> How about inline code x<sup>2</sup> – ChickenFeet Apr 17 '18 at 1:25
• It doesn't.. and I would love to have some nice syntax for writing mathematical symbols in comments.. any chance of it? – Giorgi Tsiklauri Mar 6 '20 at 8:02
• @GiorgiTsiklauri unicode magic, e.g. x² – Shadow The Vaccinated Wizard Aug 24 '20 at 12:59
• @ShadowWizardWearingMask how do you write U+00B2 like symbol here? but I need to write codes then.. which is not comfortable. – Giorgi Tsiklauri Aug 24 '20 at 13:11
• @GiorgiTsiklauri no, just copy and paste. You can copy from my comment, or from such a page that lists more. – Shadow The Vaccinated Wizard Aug 24 '20 at 13:25
• @ShadowWizardWearingMask that's not serious. :) – Giorgi Tsiklauri Aug 24 '20 at 13:56
• @GiorgiTsiklauri why not? It's a workaround. I find it easy to use, in the few cases I'll need it. – Shadow The Vaccinated Wizard Aug 24 '20 at 14:04

Another way is to use Unicode characters, e.g. 'SUPERSCRIPT TWO' (U+00B2): X²

The downside is the possible lack of support in some operating systems.

The upside is simplicity, and it also works in chat and comments, where Markdown support is very basic.

For more details, see Superscripts and Subscripts (Unicode block).