dp ↔ px Converter
Convert between density-independent pixels and real pixels across every Android bucket — and find out which values land on half a pixel and render soft.
| Density | Scale | dpi | Pixels | Notes |
|---|
Common values
Why dp exists
A physical pixel is not a fixed size. A 48 px button is comfortable on an old 240 dpi phone and uncomfortably small on a modern 480 dpi one. Density-independent pixels solve this: 1 dp is 1 px at 160 dpi, and Android scales from there. Write 48 dp and the system renders 144 px on an xxhdpi screen, so the button stays the same physical size in the user's hand.
The half-pixel problem
The awkward buckets are hdpi at 1.5× and ldpi at 0.75×. An odd dp value multiplied by 1.5 lands between pixels — 15 dp becomes 22.5 px — and Android has to round, so edges soften and a one-pixel divider can vanish entirely.
Sticking to multiples of 4 dp avoids it in every bucket, which is a large part of why Material Design is built on a 4 dp grid. This tool flags any value that does not divide cleanly and suggests the nearest one that does.
dp and sp are not the same
Use sp for text and dp for everything else. sp starts from the same baseline but also scales with the user's font size setting, so text respects accessibility preferences. Sizing text in dp means a user who has enlarged their system font gets no benefit from it in your app.