How to add subscript text in a paragraph in HTML

What is HTML Subscript Element?

In HTML, <sub> (subscript) element is used to render text in a smaller size and half a character below the normal line in a webpage.

The <sub> tag is often used to write mathematical or chemical formulas and footnotes.

Example of Creating HTML Subscript Text

In the following example, let us write the chemical formula of water.

Create an HTML <sub> element in a <p> element.

Place the text "2" between the <sub> and </sup> tags after text "H" as shown in the following example.

Example of HTML Superscript Element


Output of the above example

Example of Subscript Text


H2O (water) is an example of HTML subscript text.

<sub> tag is used to display subscript text


Here is an example of Mathematical formula (radius of a circle):


Output of the above example

Example of Subscript Text


πr (radius of a circle) is an example of HTML subscript text.

<sub> tag is used to display subscript text

Live Code Playground

In the following HTML code editor, you can practice the above code by creating more new subscript element. Click on the 'Run Code' button to render the code; the rendered page will be displayed in the following HTML Code Output frame. Practice until you become comfortable and proficient with your code.

HTML logo HTML Online Editor
HTML Code Output