Mobile development

dp sp pt px converterwith density you can inspect

Choose Android, iOS or Swift color; the scale used for each answer stays visible.

dp sp pt px converter

Input

Result

32 px

Calculation: 16 dp × 2 ÷ 1 = 32 px

Values are calculated in this browser; nothing is uploaded.

Options

Result is current.

When a design file says 16 dp but a screenshot measures 32 pixels, dp sp pt px converter keeps the chosen density beside the result. It also keeps iOS layout points separate from Android layout units.

A dp to px converter needs a device context: xhdpi means 2×, but a custom density can differ. For text, an sp to px converter can only estimate the output from fontScale on modern Android.

Why use this dp sp pt px converter?

The input and the chosen display context remain together.

Two platforms, two scales

dp sp pt px converter never treats an iOS point as an Android dp. A 44 pt target at @2x becomes 88 px, while 16 dp at xhdpi becomes 32 px.

Two separate mobile unit paths with explicit display scales and different pixel results.

Text size is marked as an estimate

For Android text, fontScale stays visible and every sp result is marked as linear. Android 14 can use a nonlinear curve, so a device API remains the authority.

Android dp path marked exact and sp path marked as a linear estimate.

Keep the display context with the number

01

Choose the platform first

Android dp and iOS pt are different layout systems. Switching modes preserves the other mode’s input rather than reinterpreting it.

  • The initial examples are 16 dp at xhdpi and 44 pt at @2x.
02

Set the actual multiplier

Select a density bucket or type the app’s DisplayMetrics.density; choose UIScreen.scale for iOS. Changing a parameter makes a previous result unavailable for copying.

  • For sp, fontScale is an estimate; use TypedValue on the device for the actual size.
03

Inspect before exporting

The formula shows the source, multiplier and target. Switch off automatic conversion to use the Convert button or Ctrl/Cmd + Enter.

  • Clear and Example show a preview, and Undo restores the previous input and result.

Calculations and code this panel actually produces

Bidirectional layout units

Convert dp to px, px to dp, iOS points to pixels and back. Custom multipliers cover displays outside named density buckets.

Text scaling with a boundary

Convert sp to px or dp through the selected density and font scale, with a visible warning wherever nonlinear Android text scaling may differ.

Two Swift color initializers

HEX to UIColor produces normalized RGB components and an alpha channel; SwiftUI Color code is generated alongside it. Numeric UIColor or Color initializers can be read back.

Which values can be trusted

No device inference
The browser cannot know the target Android app’s density or the iOS screen scale. The selected values are inputs, not detected hardware facts.
sp is a linear estimate
At Android 14+ font sizes may follow a nonlinear curve. Use TypedValue.applyDimension and deriveDimension with current DisplayMetrics for device-accurate sp.
iOS pt has a specific meaning
This point is a UIKit or SwiftUI layout unit. CSS and print pt and Android XML pt use other definitions and are outside this calculation.
Static colors only
A fixed HEX or numeric sRGB initializer cannot reveal the current value of UIColor.label, an Asset Catalog color or a Dark Mode variant. Eight-digit HEX means RRGGBBAA here.

dp sp pt px converter FAQ

What is the difference between dp and px?

dp is a density-independent Android layout unit; px is a physical screen pixel. At xhdpi density 2, 16 dp becomes 32 px. A dp sp pt px converter must know density for this answer.

What is the difference between dp and sp?

dp is for layout dimensions. sp responds to the user’s font size setting, so text set in sp can change even when a 16 dp margin does not.

How do iOS points relate to Android dp?

Both are logical layout units, but there is no universal one-to-one pixel result across platforms. iOS points use display scale; Android dp uses density.

Do I need to convert dp for Flutter development?

Flutter’s logical pixels are handled by its framework. This panel targets native Android dp/sp and iOS points, so use Flutter’s devicePixelRatio for Flutter-specific code.

What screen density do most modern phones use?

There is no safe universal density. Read the target Android app’s DisplayMetrics.density or use its known density bucket, then enter that multiplier here.

Need another answer?

Try the dp sp pt px converter with your target display

Bring a real density, scale or static color to the dp sp pt px converter; review the calculation before copying it into a design handoff.