> ## Documentation Index
> Fetch the complete documentation index at: https://autorender.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Pad resize

> Fit a video into fixed dimensions with padding and a background color.

`cm_pad_resize` scales a video to fit inside a fixed box and pads the empty space so the full frame stays visible. Set the padding color with `bg_` to avoid black letterboxing. Use it for consistent card sizes and fixed aspect-ratio layouts.

## How to use it?

Set the box with `w_` and `h_`, add `cm_pad_resize`, and choose a padding color with `bg_`. The example below fits the source into a **400×400 px** box (`w_400,h_400`) with white padding.

```text theme={null}
https://assets.autorender.io/LOKVTtKVGb/w_400,h_400,cm_pad_resize,bg_white/doc/skateboarding.mp4
```

<video src="https://assets.autorender.io/LOKVTtKVGb/w_400,h_400,cm_pad_resize,bg_white/doc/skateboarding.mp4" controls style={{ borderRadius: '0.5rem', maxWidth: '100%', display: 'block', marginLeft: 'auto', marginRight: 'auto', objectFit: 'contain' }} />

| Token           | What it does                                                                                                 |
| --------------- | ------------------------------------------------------------------------------------------------------------ |
| `cm_pad_resize` | Resize to fit the box and pad to the exact dimensions                                                        |
| `bg_{color}`    | Padding color as a name (`bg_white`, `bg_black`), hex (`bg_FF0000`), or blur (`bg_blurred`, `bg_blurred_10`) |

<Tip>
  Pair a blurred background (`bg_blurred`) with `cm_pad_resize` when you want the padding to echo the video instead of a flat color — it keeps a widescreen clip looking intentional inside a square card.
</Tip>

## Next steps

<CardGroup cols={2}>
  <Card title="Resize & aspect ratio" icon="crop-simple" iconType="solid" href="/docs/video/resize">
    Compare pad resize with the crop fit mode and ratio tokens.
  </Card>

  <Card title="Video overview" icon="clapperboard" iconType="solid" href="/docs/video/introduction">
    Every video transform token in one reference.
  </Card>
</CardGroup>
