Unit-To-Unit Pixels conversion

DP to PX

1 dp = 1 CSS pixels

One Android dp equals one CSS pixel for layout purposes: both are density-independent references at 160 and 96 nominal dpi respectively, scaled by the device pixel ratio.

Formula px = dp × 1

=

Type in either field — the other updates on every keystroke. Need other units? Open the full pixels converter.

DP to PX — quick reference
Android dp (160 dpi)CSS pixel
1 dp1 px
2 dp2 px
3 dp3 px
4 dp4 px
5 dp5 px
10 dp10 px
15 dp15 px
20 dp20 px
25 dp25 px
50 dp50 px
100 dp100 px
500 dp500 px
1000 dp1000 px
PX to DP — reverse
CSS pixelAndroid dp (160 dpi)
1 px1 dp
2 px2 dp
3 px3 dp
4 px4 dp
5 px5 dp
10 px10 dp
15 px15 dp
20 px20 dp
25 px25 dp
50 px50 dp
100 px100 dp
500 px500 dp
1000 px1000 dp

Worked examples

Common values
Screen densityFromTo (device pixels)
mdpi (160 dpi, 1×)48 dp48 px
hdpi (240 dpi, 1.5×)48 dp72 px
xhdpi (320 dpi, 2×)48 dp96 px
xxhdpi (480 dpi, 3×)48 dp144 px
xxxhdpi (640 dpi, 4×)48 dp192 px

Mental-math shortcut

Device pixels = dp × (screen dpi ÷ 160). On a 2× screen, double the dp figure.

Where this conversion comes up

Android layouts are written in dp so they look the same on every screen. In CSS terms a dp is one CSS pixel, but a 48 dp touch target is 96 device pixels on a 2× screen.

Common mistakes

Do not confuse dp with sp. Text is sized in sp, which also follows the user's font setting, while dp does not.

Background

Android defines one dp as one physical pixel on a 160 dpi (mdpi) screen, and scales it up on denser displays.

Learn more

Related guides: Digital and print layout units: px, rem, em, points and DPI

Frequently asked

How many CSS pixels are in a dp?
1 dp = 1 CSS pixels. In the other direction, 1 CSS pixel = 1 dp.
What is a dp?
An Android density-independent pixel equals one physical pixel at 160 dpi, and is functionally equivalent to a CSS pixel for layout purposes.
What is a CSS pixel?
A CSS pixel is a reference unit of 1/96 inch, not a physical device pixel. Browsers scale it by the device pixel ratio, so one CSS pixel may cover four hardware pixels on a 2× display.
How many pixels is 48 dp?
In CSS terms, 48 px. On device it depends on density: 48 px at mdpi, 96 px at xhdpi and 144 px at xxhdpi.