Droid10

Android smallest width (swXXXdp) explained

Smallest width is the number behind layout folder names like layout-sw600dp. It is not a screen size in inches and not a pixel count — it is the shorter side of the layout size, measured in dp. If you know a phone's pixel width and its reported dpi, you can compute it exactly.

The definition: the shorter side, in dp

Android first converts the physical screen to dp: dp = px / (dpi / 160), using the density the system reports — the same number wm density prints. Smallest width is then simply the smaller of the two dp sides:

sw = min(widthDp, heightDp)

On a phone held in portrait, the width is the shorter side, so the smallest width equals the layout width. That is why a Pixel 9, whose panel is 1080 px wide and which reports 480 dpi, has a smallest width of 1080 / (480 / 160) = 360 dp — written sw360dp.

Why it does not change when you rotate

Rotating a phone swaps width and height, but the smaller side stays the smaller side. A 360 × 808 dp layout becomes 808 × 360 dp in landscape, and min(360, 808) = min(808, 360) = 360 dp either way. That stability is the whole point: a layout-sw600dp folder applies whenever the device's smallest width is at least 600 dp, in either orientation, while a plain width qualifier would flip on rotation.

Worked examples from the device table

Every row below is computed at build time from the same device data used by the device pages — pixel width and height plus the reported density. No new panel specifications are introduced here, and every example ships with the stated reported density.

DeviceResolutionReported dpiLayout sizeSmallest width
Pixel 91080×2424480 dpi360 × 808 dpsw360dp
Pixel 51080×2340440 dpi393 × 851 dpsw393dp
Galaxy A34 5G1080×2340420 dpi411 × 891 dpsw411dp
Pixel 9 Pro XL1344×2992480 dpi448 × 997 dpsw448dp
Galaxy S101440×3040480 dpi480 × 1013 dpsw480dp
Galaxy Z Fold 5Inner folding display1812×2176480 dpi604 × 725 dpsw604dp

The Galaxy Z Fold 5 row is its inner folding display, which is the display stored in the device table; its cover screen is a separate display and is not computed here. A phone crosses the common 600 dp qualifier threshold only when its smallest width reaches 600 dp — of the phones above, only the Fold 5 inner display does.

Changing density changes smallest width

Smallest width follows reported dpi, not the panel. If a Pixel 9 (1080 px wide) is set to 320 dpi instead of its shipped 480 dpi, its smallest width becomes 1080 / (320 / 160) = 540 dp — layouts built for a 360 dp viewport suddenly get a 540 dp viewport, and everything on screen shrinks. That is also why the DPI changer guide warns about picking a density first and checking the resulting dp size, rather than guessing from the pixel count.

How to read your own smallest width

The fastest way is on the phone itself: Settings → Developer options → Smallest width shows the current value in dp. To compute it by hand, read the reported density first — the find your DPI guide lists four ways, including adb shell wm density — then divide the shorter pixel side by (dpi / 160) and round. The DPI calculator and dp to px converter both work from the reported density, so their dp results feed straight into the same formula.

The one-line rule: smallest width is the shorter layout side in dp, computed from pixels and reported dpi — never from ppi, and never from inches alone.

PPI vs DPI →dp to px conversion →Density buckets →Find your phone's DPI →