---
title: "inchToPixels utility"
description: "Convert inches to pixels for page formatting in Tiptap Pages."
canonical_url: "https://tiptap.dev/docs/pages/utilities/inch-to-pixels"
---

# inchToPixels utility

Convert inches to pixels for page formatting in Tiptap Pages.

The `inchToPixels` helper lets you easily convert inches to pixels, which is useful if you want to define your page or margin sizes in inches and need to convert them to pixels for the `pageFormat` option or custom layouts in the Tiptap Pages extension.

## Import

```js
import { inchToPixels } from '@tiptap-pro/extension-pages'
```

## API

```ts
inchToPixels(inches: number, dpi?: number): number
```

- `inches`: The value in inches to convert.
- `dpi` (optional): Dots per inch. If not provided, the utility will auto-detect the DPI of the current environment.
- **Returns:** The equivalent value in pixels (rounded).
