Home › Unit Converters › PX to DP Converter

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:

Direction

Pixels for PX → DP, or dp / sp for the reverse.

dpi

The device's density in dpi (e.g. 420 or 560).

Enter your values to see the result.
Advertisement
Advertisement

How to use the PX to DP Converter

  1. Choose the direction: pixels to dp, or dp / sp to pixels.
  2. Enter the value, for example 48 px or 24 dp.
  3. Pick the screen density the pixels belong to, or type a custom dpi.
  4. Set the font scale if you are converting text sizes in sp.
  5. 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

BucketDensityScale24 dp icon48 dp launcher icon
ldpi~120 dpi0.75×18 px36 px
mdpi~160 dpi1×24 px48 px
hdpi~240 dpi1.5×36 px72 px
xhdpi~320 dpi2×48 px96 px
xxhdpi~480 dpi3×72 px144 px
xxxhdpi~640 dpi4×96 px192 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.

Related tools

Device Pixel Ratio CheckerSee your device pixel ratio, CSS viewport, physical resolution and screen PPI live.PX to REM ConverterConvert px to rem or em and back, with a 1-100px table and a whole-CSS converter.PT to PXConvert points to pixels (pt to px) instantly, with formula and chart.App Icon GeneratorMake every iOS, Android adaptive, PWA and macOS app icon size from one image, as a ZIP.CM to FeetConvert centimeters to feet and back.CM to InchesConvert centimeters to inches and back.Inches to FeetConvert inches to feet (in to ft) instantly, with formula and chart.Height to CMConvert height in feet and inches to centimeters.Inches to CMConvert inches, including fractions, to centimeters.KM to MilesConvert kilometers to miles.Miles to KMConvert miles to kilometers.Feet to MetersConvert feet to meters and back.Meters to FeetConvert meters to feet and back.Pixels to Inches ConverterConvert pixels to inches, cm and mm at any DPI, find print sizes and calculate screen PPI.Feet to InchesConvert feet to inches (ft to in) instantly, with formula and chart.MM to InchesConvert millimeters to inches (mm to in) instantly, with formula and chart.Inches to MMConvert inches to millimeters (in to mm) instantly, with formula and chart.Feet to CMConvert feet to centimeters (ft to cm) instantly, with formula and chart.MM to CMConvert millimeters to centimeters (mm to cm) instantly, with formula and chart.CM to MMConvert centimeters to millimeters (cm to mm) instantly, with formula and chart.Meters to YardsConvert meters to yards (m to yd) instantly, with formula and chart.Yards to MetersConvert yards to meters (yd to m) instantly, with formula and chart.Yards to FeetConvert yards to feet (yd to ft) instantly, with formula and chart.Feet to YardsConvert feet to yards (ft to yd) instantly, with formula and chart.Meters to InchesConvert meters to inches (m to in) instantly, with formula and chart.Miles to FeetConvert miles to feet (mi to ft) instantly, with formula and chart.Feet to MilesConvert feet to miles (ft to mi) instantly, with formula and chart.Meters to CMConvert meters to centimeters (m to cm) instantly, with formula and chart.CM to MetersConvert centimeters to meters (cm to m) instantly, with formula and chart.KM to MetersConvert kilometers to meters (km to m) instantly, with formula and chart.KM to FeetConvert kilometers to feet (km to ft) instantly, with formula and chart.Meters to MilesConvert meters to miles (m to mi) instantly, with formula and chart.Nautical Miles to KMConvert nautical miles to kilometers (nmi to km) instantly, with formula and chart.MM to FeetConvert millimeters to feet (mm to ft) instantly, with formula and chart.PX to PTConvert pixels to points (px to pt) instantly, with formula and chart.PX to MMConvert pixels to millimeters (px to mm) instantly, with formula and chart.AWG to MMConvert AWG wire gauge to mm, inches, mm² and resistance per km, or mm to AWG.Ear Gauge to MM ConverterConvert ear gauge sizes (20g to 00g and up) to mm and inches and back, with a printable chart.Radiation Dose ConverterConvert Sv, mSv, rem, Gy, rad, roentgen, becquerel, curie and dpm, with dose references.Length ConverterConvert mm, cm, m, km, inches, feet, yards, miles, nautical miles, microns, mils and AU at once.Basis Points CalculatorConvert basis points to percent and decimal, and see what a bps rate change costs.Decimal Feet to Feet and InchesConvert decimal feet to feet, inches and 1/16″ fractions for construction, and back again.Decimal Inches to FractionTurn decimal inches into the nearest 1/2–1/64 fraction with error and a tape-measure diagram.Miles to StepsConvert miles to steps from your height or step length, for walking or running.MM to Fraction InchesConvert millimeters to the nearest fractional inch (1/2 to 1/64) with error and a chart.PX to CMConvert pixels to centimeters at any DPI (72, 96, 150, 300) with print-size presets.Steps to KMConvert steps to kilometers from your height or step length, for walking or running.
See all 45 Length & Distance Converters →