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.


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


will produce: x2

  • 1
    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
  • 1
    @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
  • 1
    @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
  • 1
    @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).


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .