# wrGetRootFontSize

> Reads the root font size in pixels, for converting `rem` to `px`.

Source: https://ngwr.dev/reference/utils/wr-get-root-font-size  
Kind: Util  
Updated in v16  
Optional

## Usage

```angular-ts
import { wrGetRootFontSize } from 'ngwr/utils';

const px = wrGetRootFontSize();         // e.g. 16
const remToPx = 2 * px;               // '2rem' in pixels
const onServer = wrGetRootFontSize(14); // 14 when there is no DOM
```

## API

| Name | Description | Type | Default |
| --- | --- | --- | --- |
| `wrGetRootFontSize(fallback?)` | The `:root` font size in pixels. Returns `fallback` on the server or when the value does not parse. | `(fallback = 16) => number` | `—` |

## See also

- [wrResolveCssSize](https://ngwr.dev/reference/utils/wr-resolve-css-size) — Turns a size into a CSS value and, when it can, a pixel number.
- [Sizing](https://ngwr.dev/guides/tokens/sizing) — Size and round your own controls with ngwr's tokens.
