---
title: "sqrt"
description: "The square root of a value."
group: "space"
groupTitle: "Shapes, frames & warps"
categoryId: "math"
categorySlug: "math"
categoryTitle: "Math"
kind: "function"
sourceUrl: "https://github.com/shader-effects-inc/shaders/blob/main/packages/core/src/std/math.ts#L149"
---

# sqrt

The square root of a value.

```ts
sqrt(x: Val): Expr
```

Import `math` from `shaders/std` and use `math.sqrt`.

## Parameters

| Name | Type | Notes |
|---|---|---|
| `x` | `Val` |  |

## Example

```ts
const dist = sqrt(add(mul(dx, dx), mul(dy, dy)))
```

## See also

- [`length`](/docs/primitives/math/length) — The length of a vector.
- [`pow`](/docs/primitives/math/pow) — The first value raised to the power of the second.

## Used by

[Chrome](/docs/components/chrome), [Crystal](/docs/components/crystal), [Frost](/docs/components/frost), [Goo](/docs/components/goo), [Plastic](/docs/components/plastic), [Sparkle](/docs/components/sparkle), [Waveform](/docs/components/waveform)