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.
| Android dp (160 dpi) | CSS pixel |
|---|---|
| 1 dp | 1 px |
| 2 dp | 2 px |
| 3 dp | 3 px |
| 4 dp | 4 px |
| 5 dp | 5 px |
| 10 dp | 10 px |
| 15 dp | 15 px |
| 20 dp | 20 px |
| 25 dp | 25 px |
| 50 dp | 50 px |
| 100 dp | 100 px |
| 500 dp | 500 px |
| 1000 dp | 1000 px |
| CSS pixel | Android dp (160 dpi) |
|---|---|
| 1 px | 1 dp |
| 2 px | 2 dp |
| 3 px | 3 dp |
| 4 px | 4 dp |
| 5 px | 5 dp |
| 10 px | 10 dp |
| 15 px | 15 dp |
| 20 px | 20 dp |
| 25 px | 25 dp |
| 50 px | 50 dp |
| 100 px | 100 dp |
| 500 px | 500 dp |
| 1000 px | 1000 dp |
| Screen density | From | To (device pixels) |
|---|---|---|
| mdpi (160 dpi, 1×) | 48 dp | 48 px |
| hdpi (240 dpi, 1.5×) | 48 dp | 72 px |
| xhdpi (320 dpi, 2×) | 48 dp | 96 px |
| xxhdpi (480 dpi, 3×) | 48 dp | 144 px |
| xxxhdpi (640 dpi, 4×) | 48 dp | 192 px |
Android layouts are written in dp so they look the same on every screen.
A dp, short for density-independent pixel, is Android's unit for layout sizes. It is defined against a baseline screen of 160 dots per inch, where 1 dp is exactly one physical pixel. On a denser screen the system scales the dp up: at 320 dpi (the xhdpi bucket) 1 dp is 2 device pixels, and at 480 dpi (xxhdpi) it is 3. The idea is that a 48 dp button should look about the same size in the hand whether the phone has a modest or a very sharp display.
On the web the same idea shows up as the CSS pixel, which is also a reference unit and not a hardware pixel. That is why this converter treats 1 dp as 1 CSS px: if you design a layout in CSS pixels and an Android layout in dp, the two come out the same logical size. The physical dots that light up are a different matter and depend on the device's density.
Android groups screens into density buckets with a scale factor relative to the 160 dpi baseline: ldpi 0.75× (120 dpi), mdpi 1× (160 dpi), hdpi 1.5× (240 dpi), xhdpi 2× (320 dpi), xxhdpi 3× (480 dpi) and xxxhdpi 4× (640 dpi). To get device pixels, multiply dp by the scale factor. A 16 dp margin is 16 px on mdpi, 32 px on xhdpi and 48 px on xxhdpi.
Most current phones fall in the xhdpi to xxxhdpi range, so artwork is usually exported at 2×, 3× and 4× of its dp size. A 24 dp icon needs a 24 px file for mdpi, 48 px for xhdpi, 72 px for xxhdpi and 96 px for xxxhdpi. Supplying all of them keeps icons sharp without the system having to scale them.
Because dp tracks physical size, it is the right unit for touch targets. Android's Material guidance recommends at least 48 × 48 dp for anything tappable, which works out to roughly 7 to 9 mm on a typical phone, close to the size of a fingertip pad. If an icon looks like 24 dp, keep the touch area at 48 dp by adding padding rather than enlarging the icon.
Spacing follows the same logic. Many design systems use an 8 dp grid, so margins and paddings come in steps of 4, 8, 16, 24 and 32 dp. These numbers carry across platforms, and they map directly to CSS pixels if you build the same interface for the web.
Text on Android is sized in sp (scale-independent pixels), which behave like dp but also follow the user's font-size setting. If a user sets a larger font, text in sp grows, while elements in dp stay the same. The web equivalent is rem, which scales with the root font size. When you move a design from Android to the web, convert dp to CSS px for fixed sizes, and sp to rem for text.
To convert a dp value to device pixels for a specific phone, you need its density. Look up the device's reported density (for example 2.625 on some phones), multiply, and round to the nearest whole pixel, since the system rounds when it lays out views.
A phone that is 360 dp wide is also about 360 CSS pixels wide in a mobile browser, because both units are density-independent. That is why design tools use common viewport widths of 360, 375, 390 and 412 for phones. A layout designed in dp can be implemented in CSS pixels almost unchanged, as long as you set the viewport meta tag so that the browser uses the device width.
Images are the exception. In Android you export bitmaps for each density bucket, while on the web you use srcset to give the browser a choice of 1×, 2× and 3× files. In both cases the file's pixel size is the dp size times the density: a 100 dp wide image should be 200 px wide for a 2× screen and 300 px for a 3× screen.
| Situation | From | To |
|---|---|---|
| Grid unit | 8 dp | 8 px |
| Small margin | 16 dp | 16 px |
| Icon size | 24 dp | 24 px |
| Touch target | 48 dp | 48 px |
| App bar height | 56 dp | 56 px |
| Typical phone width | 360 dp | 360 px |
Device pixels = dp × (screen dpi ÷ 160). On a 2× screen, double the dp figure.
Do not confuse dp with sp. Text is sized in sp, which also follows the user's font setting, while dp does not.
Android defines one dp as one physical pixel on a 160 dpi (mdpi) screen, and scales it up on denser displays.
Related guides: Digital and print layout units: px, rem, em, points and DPI · Unit conversion formulas by category · Where unit conversions come up in daily life