---
name: UDim
last_updated: 2026-12-04T23:21:36Z
type: datatype
summary: "Represents a one-dimensional value with two components, a relative scale and an absolute offset."
---

# UDim

Represents a one-dimensional value with two components, a relative scale and
an absolute offset.

**Type:** datatype

## Description

The [UDim](/docs/reference/engine/datatypes/UDim.md) data type represents a one-dimensional value with two
components: a relative scale and an absolute offset in logical pixels. At
evaluation time, the engine computes the final pixel value as
`Scale * referenceMeasurement + Offset`, where the reference measurement is
typically the size of a parent [GuiObject](/docs/reference/engine/classes/GuiObject.md) along the corresponding axis.

UDim values appear individually in properties such as
[UICorner.CornerRadius](/docs/reference/engine/classes/UICorner.md), [UIPadding.PaddingTop](/docs/reference/engine/classes/UIPadding.md), and
[UIStroke.Thickness](/docs/reference/engine/classes/UIStroke.md), or paired as a [UDim2](/docs/reference/engine/datatypes/UDim2.md) for
two-dimensional sizing and positioning.

## Constructors

### UDim.new

**Signature:** `UDim.new(Scale: number, Offset: number)`

Returns a new [UDim](/docs/reference/engine/datatypes/UDim.md) from the given `Scale` and `Offset`
components. Both parameters are optional and default to `0` when omitted;
calling `UDim.new()` with no arguments produces a UDim equivalent to
`UDim.new(0, 0)`.

**Parameters:**

| Name | Type | Default | Description |
|------|------|---------|-------------|
| `Scale` | `number` |  | The relative scale component, expressed as a fraction of the reference measurement (for example, `0.5` for 50% of the parent size along the corresponding axis). Defaults to `0`. |
| `Offset` | `number` |  | The absolute pixel offset added after the scale is applied. Stored as an integer. Defaults to `0`. |

**UDim.new()**

Shows how to create a [UDim](/docs/reference/engine/datatypes/UDim.md) from a scale, a fraction of the parent
size, and an offset in pixels.

```lua
local halfPlusTen = UDim.new(0.5, 10)
print(halfPlusTen) --> 0.5, 10

-- Omitted components default to 0.
print(UDim.new(1)) --> 1, 0
```

## Properties

### UDim.Scale

**Type:** `number`

The relative scale component of the [UDim](/docs/reference/engine/datatypes/UDim.md), expressed as a
fraction of a reference measurement (typically the corresponding axis of a
parent [GuiObject](/docs/reference/engine/classes/GuiObject.md)). A value of `1` represents the full reference
measurement, `0.5` represents half, and `0` means the scale contributes
nothing to the resolved pixel value. Defaults to `0` when not specified in
the constructor. This property is read-only.

**UDim.Scale**

Shows how to read the scale of a [UDim](/docs/reference/engine/datatypes/UDim.md), the fraction of the parent's
size.

```lua
local size = UDim.new(0.25, 40)
print(size.Scale) --> 0.25

-- Multiply the scale by a parent's size to get the pixels it stands for.
print(size.Scale * 800) --> 200
```

### UDim.Offset

**Type:** `number`

The absolute offset component of the [UDim](/docs/reference/engine/datatypes/UDim.md) in pixels. This value
is added to the resolved scale portion (`Scale * referenceMeasurement`) to
produce the final pixel measurement. The offset is stored as an integer.
Defaults to `0` when not specified in the constructor. This property is
read-only.

**UDim.Offset**

Shows how to read the offset of a [UDim](/docs/reference/engine/datatypes/UDim.md), a fixed number of pixels.

```lua
local size = UDim.new(0.25, 40)
print(size.Offset) --> 40

-- The offset is an integer.
print(UDim.new(0, 10.7).Offset) --> 10
```

## Math Operations

| Operation | Type A | Type B | Returns | Description |
|-----------|--------|--------|---------|-------------|
| `+` | `UDim` | `UDim` | `UDim` | Produces a [UDim](/docs/reference/engine/datatypes/UDim.md) representing the sum of the two [UDim](/docs/reference/engine/datatypes/UDim.md) values. |
| `-` | `UDim` | `UDim` | `UDim` | Produces a [UDim](/docs/reference/engine/datatypes/UDim.md) representing the difference between the two [UDim](/docs/reference/engine/datatypes/UDim.md) values. |