9-Slice (Nine-Patch) Tool

Scale a small panel, button or dialog frame to any size while its corners stay crisp. Auto-detect the borders, check the result, then paste the numbers into your engine.

Drop a UI panel, button or frame image here, or click to choose.
Find the 9-slice borders, preview any size and copy the values for your engine.

How to set up a 9-slice UI element

  1. Drop a panel, button or frame image. The borders are detected automatically and shown as pink guide lines.
  2. Adjust left, right, top and bottom if needed. Each corner should contain the whole rounded corner or ornament.
  3. Drag the preview size to check that corners stay sharp and edges join cleanly. Switch to Tile for patterned edges.
  4. Copy the values for your engine. You can also download a resized PNG if you need a fixed size.

Engine setup

Designing 9-slice art

FAQ

What is 9-slicing?

The image is cut into 9 parts by two vertical and two horizontal lines. Corners never scale, the edges stretch (or repeat) in one direction, and the center fills the rest. One small image can then frame UI elements of any size.

How does auto-detect work?

It looks for the longest run of identical columns and rows: that repeating middle part is what can stretch without changing the look. Everything outside becomes the border. Check the pink guides and adjust if needed.

Stretch or tile?

Stretch for flat or gradient edges. Tile for patterned borders (rope, bricks, ornaments), so the pattern repeats instead of smearing. Godot (axis stretch mode Tile), Unity (Draw Mode Tiled) and CSS (round/repeat) support both.

Why does Unity list the border as L, B, R, T?

Unity's sprite border is a Vector4 in the order left, bottom, right, top. The tool prints the values in that order so you can type them directly into the Sprite Editor.

Is my image uploaded?

No. The preview is rendered in your browser.