---
title: "Scale a value from one range to another"
description: "Normalize data by scaling values between ranges in TypeScript."
date: "2025-10-02"
tags: ["typescript","math","scale","frontend"]
canonical: "/snippets/typescript/number/scale"
---

import { Code } from '@astrojs/starlight/components'
import { Aside } from '@astrojs/starlight/components'
import Source from './scale.ts?raw'

## Scale a value from one range to another

<Aside type="note">
  <strong>Note</strong>: This function is useful to normalize data.
</Aside>

<Code code={Source} lang="ts" title="scale.ts" wrap />
