Home › Free tools › dp to px converter
Free Android dev tool · No signup

dp to px converter for every Android screen density

Convert dp, sp and px instantly for mdpi, hdpi, xhdpi, xxhdpi and xxxhdpi – or any custom dpi. See every density at once, with font scaling for sp and iOS point sizes too.

dp ↔ px ↔ spAll densities in one tableCustom dpi and font scale
Common values:
DensitydpiScalepxdpsp

Tap a px value to copy it. Formula: px = dp × (dpi ÷ 160), and px = sp × (dpi ÷ 160) × font scale.

dp, sp and px explained

px are real screen pixels. dp (density-independent pixels) are what Android layouts use: 1 dp is one pixel on a 160 dpi (mdpi) screen, so a 48 dp button looks the same physical size on every phone. sp (scale-independent pixels) work like dp but also follow the user’s font size setting – always use sp for text.

Android density buckets

Bucketdpi1 dp equalsLauncher icon (48 dp)
ldpi1200.75 px36 px
mdpi1601 px48 px
hdpi2401.5 px72 px
xhdpi3202 px96 px
xxhdpi4803 px144 px
xxxhdpi6404 px192 px

Convert in code

In Kotlin with Jetpack Compose you rarely convert by hand – use 16.dp and 14.sp, and inside a composable with(LocalDensity.current) { 16.dp.toPx() }. In the View system: TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 16f, resources.displayMetrics).

Handy sizes to remember

  • 48 dp – minimum touch target in Material Design.
  • 8 dp grid – most spacing in Material is a multiple of 8 (or 4 for small details).
  • 14–16 sp – normal body text; 12 sp is the smallest comfortable size.
  • 360 dp – a typical phone width in dp.

Frequently asked questions

How do I convert dp to px?

px = dp × (dpi ÷ 160). On an xxhdpi phone (480 dpi), 16 dp = 16 × 3 = 48 px.

What is the difference between dp and sp?

Both scale with screen density, but sp also scales with the user’s font size setting. Use sp for text and dp for everything else.

How do I find my phone’s dpi?

Turn on Developer options and check “Smallest width”, or use an app that shows display metrics. In code, read resources.displayMetrics.densityDpi.

Is 1 dp the same as 1 iOS point?

They are very close in purpose. Both are about 1/160 inch on a reference screen. iOS @2x screens use 2 px per point and @3x screens use 3 px.

Why does sp text get bigger on some phones?

Because the user has a larger font size in Accessibility settings. Android 14 and later can scale fonts up to 200%, and large text scales a little less than small text, so test your layouts with big font sizes.

Need a website or app built?

We design and build websites and Android apps for clients worldwide – clear scope, fixed price, fast delivery.

Techpass Master Technologies · Websites, Android apps and digital marketing

WhatsApp us📞 Call now