PX to DP Converter
Convert pixels to Android density-independent pixels (dp) and scale-independent pixels (sp) for any screen density, or turn dp and sp back into pixels. The table lists the exact asset size for every bucket from ldpi to xxxhdpi, plus iOS @1x, @2x and @3x.
Last updated:
Pixels for PX → DP, or dp / sp for the reverse.
The device's density in dpi (e.g. 420 or 560).
How to use the PX to DP Converter
- Choose the direction: pixels to dp, or dp / sp to pixels.
- Enter the value, for example 48 px or 24 dp.
- Pick the screen density the pixels belong to, or type a custom dpi.
- Set the font scale if you are converting text sizes in sp.
- Press Convert and use the table to export assets for every density.
PX to DP formula
dp = px × 160 ÷ dpi and px = dp × dpi ÷ 160. Android defines one density-independent pixel as one physical pixel on a 160 dpi (mdpi) screen, so the scale factor for any screen is its density divided by 160. For text, px = sp × font scale × dpi ÷ 160.
Example: a 72 × 72 px image designed for an xxhdpi phone (480 dpi, 3×) is 72 ÷ 3 = 24 × 24 dp. To ship that icon for every density you need 18, 24, 36, 48, 72 and 96 px versions.
Android density buckets
| Bucket | Density | Scale | 24 dp icon | 48 dp launcher icon |
|---|---|---|---|---|
| ldpi | ~120 dpi | 0.75× | 18 px | 36 px |
| mdpi | ~160 dpi | 1× | 24 px | 48 px |
| hdpi | ~240 dpi | 1.5× | 36 px | 72 px |
| xhdpi | ~320 dpi | 2× | 48 px | 96 px |
| xxhdpi | ~480 dpi | 3× | 72 px | 144 px |
| xxxhdpi | ~640 dpi | 4× | 96 px | 192 px |
tvdpi (~213 dpi, 1.33×) is mainly used by some TVs and older tablets; Android scales resources from other buckets for it.
Tips for designers and developers
- Design at 1× in dp. Work on a 360 dp wide frame (a common phone width) and export at 1.5×, 2×, 3× and 4×.
- Touch targets should be at least 48 × 48 dp, which is 144 × 144 px on an xxhdpi screen.
- Use vector drawables for icons where possible so one file scales to every density.
- Always use sp for text so people who enlarge their system font size can read your app. Recent Android versions scale large text sizes less than small ones, so very large sp values may grow less than the font scale suggests.
- iOS: layout uses points; @2x devices draw 2 px per point and @3x devices 3 px per point.
Frequently asked questions
How do I convert px to dp?
Divide the pixels by the density scale factor, which is the screen dpi divided by 160: dp = px × 160 ÷ dpi. On an xxhdpi screen (480 dpi, 3×), 48 px = 16 dp.
How do I convert dp to px?
Multiply by the scale factor: px = dp × dpi ÷ 160. 24 dp is 18 px on ldpi, 24 px on mdpi, 36 px on hdpi, 48 px on xhdpi, 72 px on xxhdpi and 96 px on xxxhdpi.
What is the difference between dp and sp?
Both are 1 px at 160 dpi, but sp is also multiplied by the user's font size setting. At the default font scale 1 sp = 1 dp; at a 1.3 font scale, 16 sp text is drawn as 20.8 dp. Use sp for text and dp for everything else.
What are the Android density buckets?
ldpi 120 dpi (0.75×), mdpi 160 dpi (1×), tvdpi 213 dpi (≈1.33×), hdpi 240 dpi (1.5×), xhdpi 320 dpi (2×), xxhdpi 480 dpi (3×) and xxxhdpi 640 dpi (4×). Devices with other densities are mapped to the nearest bucket for resources.
Is a dp the same as an iOS point?
They play the same role: a layout unit independent of pixel density. 1 dp is 1 px at mdpi and 1 pt is 1 px at @1x, so a 44 pt iOS button and a 44 dp Android button are about the same size, though the baselines are not exactly identical.
Why do my dp values have decimals?
Pixel sizes that are not a multiple of the scale factor give fractional dp, for example 50 px at xxhdpi = 16.667 dp. Designers usually pick dp values first (often on a 4 or 8 dp grid) and export pixels from those.
Are all the tools on FreeToolCabin tested for quality and accuracy?
Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.