# 9-slicing

> Learn about creating a sprite with nine sections, so the sections stretch or repeat in different ways to keep the sprite in proportion.

9-slicing is a 2D technique that allows you to resize a sprite without creating multiple sprites for all the different sizes.

To use 9-slicing, you create a sprite with nine sections. The different sections stretch or repeat in different ways to keep the sprite in proportion.

9-slicing is useful for creating patterns, walls, or floors in a 2D environment.

> **Note:**
>
> You can only use a [Box Collider 2D](/engine/6000.3/manual/unity2d/2d-physics/collider-2d/box-collider-2d-reference.md) or [Polygon Collider 2D](/engine/6000.3/manual/unity2d/2d-physics/collider-2d/polygon-collider-2d-reference.md) component to add a collision shape to a 9-sliced sprite. For more information, refer to [9-slice a sprite](/engine/6000.3/manual/unity2d/sprite/9-slice/set-sprite-9slicing.md).

## 9-slicing modes

If you don't use 9-slicing, the entire sprite stretches when you change its dimensions.


**A square floor sprite.:**
![](/api/media?file=/engine/6000.3/media/images/9-slice-4.jpg)


**The same sprite resized so it's wider. The floor, walls, and corners all stretch horizontally.:**
![](/api/media?file=/engine/6000.3/media/images/9-slice-5.png)

With 9-slicing, you can resize the sprite using sliced mode or tiled mode.

### Sliced

In sliced mode, the sprite does the following:

* The corners stay the same size.
* The top and bottom borders of the sprite stretch only horizontally.
* The left and right borders of the sprite stretch only vertically.
* The center stretches horizontally and vertically.


**The same sprite in sliced mode, resized so it's wider.:**
![](/api/media?file=/engine/6000.3/media/images/9-slice-6.png)

### Tiled

In tiled mode, the sprite does the following:

* The corners stay the same size.
* The top and bottom borders of the sprite repeat horizontally.
* The left and right borders of the sprite repeat vertically.
* The center repeats horizontally and vertically.


**The same sprite in tiled mode, resized so it's wider.:**
![](/api/media?file=/engine/6000.3/media/images/9-slice-7.png)

You can control how Unity repeats the texture across the resized sprite. For more information, refer to [9-slice a sprite](/engine/6000.3/manual/unity2d/sprite/9-slice/set-sprite-9slicing.md).

## Additional resources

* [Import a sprite or texture](/engine/6000.3/manual/unity2d/sprite/import-images-sprites.md)
* [Set background images](/engine/6000.3/manual/uitoolkits/uielements/uie-uss/properties/uib-styling-ui-backgrounds.md) in the UI Toolkit documentation.
