---
title: "Subscript extension"
description: "Learn how to use the Subscript extension in Tiptap to write slightly below the normal line and show your unique style."
---

> This page is for Tiptap 2.x. [See the latest version of this page.](https://tiptap.dev/docs/editor/extensions/marks/subscript.md)

# Subscript extension

Learn how to use the Subscript extension in Tiptap to write slightly below the normal line and show your unique style.

Use this extension to render text in <sub>subscript</sub>. If you pass `<sub>` or text with `vertical-align: sub` as inline style in the editor’s initial content, both will be rendered accordingly.

> **Restrictions**
>
> The extension will generate the corresponding `<sub>` HTML tags when reading contents of the `Editor` instance. All text in subscript, regardless of the method will be normalized to `<sub>` HTML tags.

> **Interactive demo:** [Subscript](https://v2--tiptap-embed.netlify.app/preview/Marks/Subscript)

## Install

```bash
npm install @tiptap/extension-subscript
```

## Settings

### HTMLAttributes

Custom HTML attributes that should be added to the rendered HTML tag.

```js
Subscript.configure({
  HTMLAttributes: {
    class: 'my-custom-class',
  },
})
```

## Commands

### setSubscript()

Mark text as subscript.

```js
editor.commands.setSubscript()
```

### toggleSubscript()

Toggle subscript mark.

```js
editor.commands.toggleSubscript()
```

### unsetSubscript()

Remove subscript mark.

```js
editor.commands.unsetSubscript()
```

## Keyboard shortcuts

| Command           | Windows/Linux                     | macOS                         |
| ----------------- | --------------------------------- | ----------------------------- |
| toggleSubscript() | <kbd>Control</kbd> + <kbd>,</kbd> | <kbd>Cmd</kbd> + <kbd>,</kbd> |

## Source code

[packages/extension-subscript/](https://github.com/ueberdosis/tiptap/blob/main/packages/extension-subscript/)
