---
title: "min"
description: "The smaller of two values."
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#L238"
---

# min

The smaller of two values.

```ts
min(a: Val, b: Val): Expr
```

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

## Parameters

| Name | Type | Notes |
|---|---|---|
| `a` | `Val` |  |
| `b` | `Val` |  |

## Example

```ts
const capped = min(brightness, 1)
```

## See also

- [`max`](/docs/primitives/math/max) — The larger of two values.
- [`clamp`](/docs/primitives/math/clamp) — The value limited to the range `lo`..`hi`.

## Used by

[CarbonFiber](/docs/components/carbonfiber), [Chrome](/docs/components/chrome), [Goo](/docs/components/goo), [Heatmap](/docs/components/heatmap), [Hologram](/docs/components/hologram), [ReactionDiffusion](/docs/components/reactiondiffusion), [Sparkle](/docs/components/sparkle)