To write Subscript in HTML use <sub> tag and
to write SuperScript in HTML use <sup> tag as shown in the example below.
<!DOCTYPE html>
<html>
<body>
Chemical formula of Oxgen (O2) is written as O<sub>2</sub>
X squared (X2) is written as X<sup>2</sup>
</body>
</html>
to write SuperScript in HTML use <sup> tag as shown in the example below.
<!DOCTYPE html>
<html>
<body>
Chemical formula of Oxgen (O2) is written as O<sub>2</sub>
X squared (X2) is written as X<sup>2</sup>
</body>
</html>