---
title: measureText
framework: webkitjs
role: symbol
role_heading: Instance Method
path: webkitjs/canvasrenderingcontext2d/1631690-measuretext
---

# measureText

Determines the width of the bounding box required to render the specified text with the current font settings.

## Declaration

```data
TextMetrics measureText(
    DOMString text
);
```

## Parameters

- `text`: A string containing the text to measure.

## Return Value

Return Value An object whose width property contains the width in pixels of the bounding box needed to render the text without clipping.

## Discussion

Discussion Use this method to determine how much space is needed to render a string, or to measure the width of an existing string.

## See Also

### Drawing Text

- [fillText](webkitjs/canvasrenderingcontext2d/1634243-filltext.md)
- [font](webkitjs/canvasrenderingcontext2d/1632249-font.md)
- [strokeText](webkitjs/canvasrenderingcontext2d/1630188-stroketext.md)
- [textAlign](webkitjs/canvasrenderingcontext2d/1631811-textalign.md)
- [textBaseline](webkitjs/canvasrenderingcontext2d/1629692-textbaseline.md)
