Droid10

dp to px converter

px = dp × (dpi ÷ 160). Type any density — 160/240/320/480/640 buckets or the exact value your phone reports, such as 420 or 440 dpi — and convert dp → px, px → dp and sp → px instantly. Everything runs in your browser.

Density

Scale factor: 2.750×

1 dp = 2.750 px. Find your value with adb shell wm density.

dp → px

44.00 px

px → dp

—

sp → px

—

Assumes the user's font scale is 1.0. A user with larger system text will get more pixels at the same sp, which is the whole point of sp.

dp → px conversion table (standard densities)

Values are rounded to the nearest whole pixel using px = dp × dpi ÷ 160. The three last columns cover the non-bucket densities most Android phones actually report.

dp120 dpi
ldpi
160 dpi
mdpi
240 dpi
hdpi
320 dpi
xhdpi
480 dpi
xxhdpi
640 dpi
xxxhdpi
420 dpi440 dpi560 dpi
1112234334
2223468567
434681216111114
86812162432212228
1291218243648323342
16121624324864424456
20152030406080535570
24182436487296636684
3224324864961288488112
4030406080120160105110140
4836487296144192126132168
56425684112168224147154196
64486496128192256168176224
725472108144216288189198252
967296144192288384252264336
12090120180240360480315330420
160120160240320480640420440560
200150200300400600800525550700
240180240360480720960630660840
32024032048064096012808408801120

Common anchors: 48 dp touch target = 96 px (xhdpi) / 144 px (xxhdpi); 16 dp margin = 42 px (420 dpi); 1 dp at 480 dpi = 3 px.

Real device densities, from the Droid10 device database

The dpi below is the value the system reports (not the bucket it resolves to), so these are the numbers to type into the converter. 48 dp and 1,000 dp are shown as the standard minimum touch target and a full-width column.

DeviceResolutionReported dpiBucket48 dp1,000 dp
Pixel 91080 × 2424480xxhdpi144 px3000 px
Pixel 81080 × 2400480xxhdpi144 px3000 px
Pixel 9 Pro1280 × 2856480xxhdpi144 px3000 px
Galaxy S241080 × 2340480xxhdpi144 px3000 px
Galaxy S231080 × 2340480xxhdpi144 px3000 px
OnePlus 121440 × 3168480xxhdpi144 px3000 px
Galaxy A54 5G1080 × 2340450xxhdpi135 px2813 px

* nearest density bucket estimate — the exact shipped dpi for this model is not in our table. Every device page shows the same derivation.

px → dp in code

Hardcoding the maths is a bug waiting to happen — densities change with the user's display-size setting. In Kotlin/Java, let the framework convert:

// Kotlin
fun Context.dpToPx(dp: Float): Float =
    dp * resources.displayMetrics.density

// px -> dp
fun Context.pxToDp(px: Float): Float =
    px / resources.displayMetrics.density

// Any dimension to px, honours the unit you pass
val px = TypedValue.applyDimension(
    TypedValue.COMPLEX_UNIT_DIP, 48f, resources.displayMetrics
)

displayMetrics.density is exactly dpi ÷ 160 (0.75 at 120 dpi, 2.625 at 420 dpi, 3.0 at 480 dpi), which is why it is the only multiplier you need. For Compose, use LocalDensity.current.run { dp.toPx() }.

dp vs px vs sp — which one to use

UnitScales with densityScales with user font sizeUse for
dpYesNoLayout size, spacing, touch targets, icons
spYesYesText — the only unit that respects accessibility font scaling
pxNoNoRaw physical pixels: bitmap assets, 1 px dividers, Bitmap width/height

A common mistake is a px-based canvas or custom View that looks right on a 480 dpi phone and half-size on a 240 dpi tablet. Convert once at the drawing boundary: take the dp spec, multiply by density, then work in px internally.

Frequently asked

How many pixels is 16 dp?

16 dp is 16 px at 160 dpi, 32 px at 320 dpi, 42 px at 420 dpi, 44 px at 440 dpi and 48 px at 480 dpi. In terms of physical size it is always about 2.54 mm.

Do I need a converter for the density bucket?

Not for maths — buckets are just 160/240/320/480/640 dpi. But if you are picking a drawable folder (mdpi → xxxhdpi) for an arbitrary dpi, use the density bucket converter, which rounds the reported dpi to the correct folder.

Where do I find my device's dpi?

Run adb shell wm density, or read our guide to finding Android dpi. If the value is 420 or 440, that is the real panel density — keep it and let the nearest bucket handle resource selection.

Related tools and guides

Density buckets used above: ldpi 120, mdpi 160, hdpi 240, xhdpi 320, xxhdpi 480, xxxhdpi 640.