---
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."
canonical_url: "https://tiptap.dev/docs/editor/extensions/marks/subscript"
---

# 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 subscript. 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://embed.tiptap.dev/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() | Control + ,   | Cmd + , |

## Source code

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