• 16:9 1920 × 1080
  • 4K UHD 3840 × 2160 is 16:9
  • 21:9 really 64:27 (2.37:1)
  • 9:16 Reels · Shorts · TikTok
  • 4:5 1080 × 1350 portrait posts
  • 27″ 1440p 108.8 PPI
  • 48 dp 144 px at xxhdpi
  • 1366 × 768 ≈ 16:9
  • 16:10 11% taller than 16:9
  • 2.39:1 cinema scope
  • 32:9 5120 × 1440
  • 3:2 6000 × 4000 camera sensors
  1. Home
  2. DP to PX Converter

DP to PX Converter

Convert Android density-independent pixels (dp) into physical pixels for every screen density, or go the other way from px to dp. Handy for icons, touch targets and exporting assets.

DP → PX

PX → DP

96 px = 48 dp

Physical pixels

48px

Android rounds to whole pixels when it applies a size.

DensityScalePixels

What is a dp?

A density-independent pixel (dp, sometimes written dip) is Android's virtual unit for layout. One dp equals one physical pixel on a 160 dpi screen, the "medium density" (mdpi) baseline. On denser screens each dp covers more physical pixels, so a 48 dp button is roughly the same physical size on a budget phone and on a flagship.

The DP to PX formula

px = dp × (dpi ÷ 160)dp = px ÷ (dpi ÷ 160)

For example, 16 dp on a 480 dpi (xxhdpi) screen is 16 × (480 ÷ 160) = 16 × 3 = 48 px. Going the other way, a 96 px image on an xhdpi (320 dpi) screen is 96 ÷ 2 = 48 dp.

Android density buckets

Android groups screens into generalized density buckets and lets you supply bitmap resources for each one. The last column shows the pixel size of a standard 48 dp launcher icon in each bucket.

BucketApprox. dpiScale48 dp icon
ldpi1200.75×36 px
mdpi1601×48 px
tvdpi213≈1.33×64 px
hdpi2401.5×72 px
xhdpi3202×96 px
xxhdpi4803×144 px
xxxhdpi6404×192 px

Real devices rarely match a bucket exactly. A phone with a 420 dpi screen has a scale factor of 2.625, so 16 dp becomes 42 px. Android picks bitmap resources from the closest bucket and scales them, while layout sizes in dp are converted using the device's actual density.

dp vs. sp

Use sp (scale-independent pixels) for text. An sp starts out the same as a dp, but it also scales with the user's font size setting, so text stays readable for people who enlarge it. Use dp for everything else: margins, padding, icon sizes and touch targets.

How dp compares with iOS points and CSS pixels

Other platforms use the same idea. On iOS, layouts are measured in points and rendered at @1x, @2x or @3x, so a 44 pt button is 132 px on a @3x iPhone. On the web, the CSS pixel is a reference unit, and window.devicePixelRatio tells you how many device pixels each one covers. A CSS pixel at a device pixel ratio of 3 behaves much like a dp on an xxhdpi phone.

Common sizes in dp

  • 48 × 48 dp: the minimum touch target recommended by Material Design, and the size of a launcher icon.
  • 24 dp: the standard Material system icon size.
  • 16 dp: a common margin at the edge of a phone screen.
  • 56 dp: the size of a standard floating action button.
  • 8 dp: the base step of Material's spacing grid.

Frequently asked questions

How many pixels is 1 dp?

Exactly 1 px on a 160 dpi (mdpi) screen, 2 px on xhdpi, 3 px on xxhdpi and 4 px on xxxhdpi. On any other screen, multiply by the device's dpi ÷ 160.

Should I design in dp or px?

Specify layouts in dp and text in sp. Only work in px when you are exporting bitmap assets for a specific density.

How do I find my phone's density?

With the phone connected, run adb shell wm density, or read resources.displayMetrics.densityDpi in your app's code.

Related tools