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.
| dp | 120 dpi ldpi | 160 dpi mdpi | 240 dpi hdpi | 320 dpi xhdpi | 480 dpi xxhdpi | 640 dpi xxxhdpi | 420 dpi | 440 dpi | 560 dpi |
|---|---|---|---|---|---|---|---|---|---|
| 1 | 1 | 1 | 2 | 2 | 3 | 4 | 3 | 3 | 4 |
| 2 | 2 | 2 | 3 | 4 | 6 | 8 | 5 | 6 | 7 |
| 4 | 3 | 4 | 6 | 8 | 12 | 16 | 11 | 11 | 14 |
| 8 | 6 | 8 | 12 | 16 | 24 | 32 | 21 | 22 | 28 |
| 12 | 9 | 12 | 18 | 24 | 36 | 48 | 32 | 33 | 42 |
| 16 | 12 | 16 | 24 | 32 | 48 | 64 | 42 | 44 | 56 |
| 20 | 15 | 20 | 30 | 40 | 60 | 80 | 53 | 55 | 70 |
| 24 | 18 | 24 | 36 | 48 | 72 | 96 | 63 | 66 | 84 |
| 32 | 24 | 32 | 48 | 64 | 96 | 128 | 84 | 88 | 112 |
| 40 | 30 | 40 | 60 | 80 | 120 | 160 | 105 | 110 | 140 |
| 48 | 36 | 48 | 72 | 96 | 144 | 192 | 126 | 132 | 168 |
| 56 | 42 | 56 | 84 | 112 | 168 | 224 | 147 | 154 | 196 |
| 64 | 48 | 64 | 96 | 128 | 192 | 256 | 168 | 176 | 224 |
| 72 | 54 | 72 | 108 | 144 | 216 | 288 | 189 | 198 | 252 |
| 96 | 72 | 96 | 144 | 192 | 288 | 384 | 252 | 264 | 336 |
| 120 | 90 | 120 | 180 | 240 | 360 | 480 | 315 | 330 | 420 |
| 160 | 120 | 160 | 240 | 320 | 480 | 640 | 420 | 440 | 560 |
| 200 | 150 | 200 | 300 | 400 | 600 | 800 | 525 | 550 | 700 |
| 240 | 180 | 240 | 360 | 480 | 720 | 960 | 630 | 660 | 840 |
| 320 | 240 | 320 | 480 | 640 | 960 | 1280 | 840 | 880 | 1120 |
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.
| Device | Resolution | Reported dpi | Bucket | 48 dp | 1,000 dp |
|---|---|---|---|---|---|
| Pixel 9 | 1080 × 2424 | 480 | xxhdpi | 144 px | 3000 px |
| Pixel 8 | 1080 × 2400 | 480 | xxhdpi | 144 px | 3000 px |
| Pixel 9 Pro | 1280 × 2856 | 480 | xxhdpi | 144 px | 3000 px |
| Galaxy S24 | 1080 × 2340 | 480 | xxhdpi | 144 px | 3000 px |
| Galaxy S23 | 1080 × 2340 | 480 | xxhdpi | 144 px | 3000 px |
| OnePlus 12 | 1440 × 3168 | 480 | xxhdpi | 144 px | 3000 px |
| Galaxy A54 5G | 1080 × 2340 | 450 | xxhdpi | 135 px | 2813 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
| Unit | Scales with density | Scales with user font size | Use for |
|---|---|---|---|
| dp | Yes | No | Layout size, spacing, touch targets, icons |
| sp | Yes | Yes | Text — the only unit that respects accessibility font scaling |
| px | No | No | Raw 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
- DPI / PPI calculator — compute density from resolution and diagonal size
- Resolution to DPI chart — 1080p, 1440p and 4K panels across screen sizes
- Density bucket converter — mdpi/hdpi/xhdpi/xxhdpi/xxxhdpi and drawable folders
- How to convert dp to px — formula walkthrough with worked examples
- sw (smallest width) qualifiers — the dp-based breakpoints Android uses for layouts
- Aspect ratio calculator — 16:9, 19.5:9 and 20:9 phone panels
Density buckets used above: ldpi 120, mdpi 160, hdpi 240, xhdpi 320, xxhdpi 480, xxxhdpi 640.