Skip to main content
Mobile & Apps New

DP, SP, PT, PX & Mobile Screen Density Matrix Calculator

Calculate and scale UI dimensions across iOS point scales (@1x, @2x, @3x) and Android screen densities (mdpi, hdpi, xhdpi, xxhdpi, xxxhdpi). Includes accessibility text scaling and Swift/Kotlin code snippets.

Comprehensive Multi-Platform Matrix: Instant bi-directional conversion between Android DP / SP, iOS Points (PT), physical Pixels (PX), and Web CSS Pixels
Complete Android Bucket Breakdown: Real-time calculation across ldpi (0.75x), mdpi (1.0x baseline), hdpi (1.5x), xhdpi (2.0x), xxhdpi (3.0x), and xxxhdpi (4.0x)
iOS Retina Scaling: Calculates exact physical pixel assets for standard @1x, Retina @2x, and Super Retina @3x displays
Accessibility & Dynamic Type Simulator: Preview SP to PX scaling under Android Accessibility font scale factors (1.0x to 2.0x) and iOS Dynamic Type sizes
Hardware PPI & Screen Diagonal Math: Input physical width, height, and diagonal inches to compute exact PPI, aspect ratio, and baseline density bucket
Ready-to-use Code Snippets: Instant copyable sizing constants in Swift (SwiftUI/UIKit), Kotlin (Jetpack Compose/XML), and Flutter (Dart)
01 // VIEWPORT & DENSITY MATRIXMobile Screen Density & Unit Matrix@3x • iPhone 16 Pro
REAL-TIME ALL PLATFORMS
PRESETS:
ROOT FONT SCALE:16px
10px16px (REF)24px
COL.01 // ANDROID BUCKETS

Density Multipliers

24 dp
ldpi(120 dpi)
drawable-ldpi/
18 px
mdpi(160 dpi)
drawable-mdpi/
24 px
hdpi(240 dpi)
drawable-hdpi/
36 px
xhdpi(320 dpi)
drawable-xhdpi/
48 px
xxhdpi(480 dpi)
drawable-xxhdpi/
72 px
xxxhdpi(640 dpi)
drawable-xxxhdpi/
96 px
BASELINE: MDPI (160 DPI) = 1.0x (1DP = 1PX)
APPLE RETINA RATIOS

Point Resolution

24 pt
@1xStandard (1.0x)
Assets.xcassets .png
24 px~163 ppi
@2xRetina (2.0x)
Assets.xcassets @2x.png
48 px~326 ppi
@3xSuper Retina (3.0x)
Assets.xcassets @3x.png
72 px~460 ppi
BASELINE: @1X (163 PPI) = 1PT = 1PX
WEB CSS UNITS

Relative Units

24 px
remRoot-relative (16px baseline)
1.5 rem
emParent-relative container scale
1.5 em
Tailwind CSSUtility class helper
w-[24px]
W3C STANDARD: 96 CSS PX = 1 INCH
INDEX.02 // PHYSICAL DENSITY COMPARATOR

Physical Bitmap Render Scaling

24px
mdpi(1x)
36px
hdpi(1.5x)
48px
xhdpi(2x)
72px
xxhdpi(3x)
96px
xxxhdpi(4x)
WebCraftKit platform · 100% client-side engine

Air-Gapped Privacy & Zero-Latency Developer Utilities

Every cryptographic algorithm, schema transformer, color space converter, and binary extractor runs entirely in your browser RAM. Your tokens, API secrets, and source code are never sent to external servers.

0 B server telemetry
·
< 2ms execution
·
80 production tools
Read architecture story →
Comprehensive technical manual

The Comprehensive Guide to Screen Densities, DP, SP, Points, and High-DPI Mobile Displays

In-depth specifications, architectural mechanics, real-world code implementations, and industry best practices.

01

The Foundations of Resolution Independence: Density-Independent Pixels vs Points

Physical display hardware renders images using microscopic physical pixels (PX). Because mobile displays vary from low-density 130 PPI budget screens to 460+ PPI Super Retina OLED panels, specifying UI dimensions in raw hardware pixels causes identical layouts to render microscopic on high-density devices. To achieve resolution independence, mobile operating systems abstract physical pixels: Google Android defines the Density-Independent Pixel (DP), anchored to a 160 DPI baseline where 1dp = 1px, while Apple iOS defines the Point (PT), anchored to 163 PPI where 1pt = 1px on legacy @1x displays.

Implementation example
// Universal Density Scaling Mathematical Formulas
// Android: px = dp * (dpi / 160)
// iOS:     px = pt * scale_factor (where @2x = 2.0, @3x = 3.0)
// SP:      px = sp * (dpi / 160) * font_scale_factor
// PPI:     sqrt(width_px^2 + height_px^2) / diagonal_inches
02

Android Density Buckets and Apple Retina Display Architecture

Android groups screen densities into six generalized buckets: ldpi (~120 dpi, 0.75x ratio), mdpi (~160 dpi, 1.0x baseline), hdpi (~240 dpi, 1.5x ratio), xhdpi (~320 dpi, 2.0x ratio), xxhdpi (~480 dpi, 3.0x ratio), and xxxhdpi (~640 dpi, 4.0x ratio). In Apple iOS architecture, vector rendering utilizes points, which are multiplied by the device scale factor: @1x (iPad 2), @2x (iPhone 11, iPad Air, iPhone SE), and @3x (iPhone X, 12, 13, 14, 15, 16 Pro Super Retina XDR). In Flutter, all dimensions use logical pixels (identical to iOS points / Android DP at mdpi).

Implementation example
// Kotlin / Swift runtime density conversion utilities

// 1. Android Kotlin Extension
fun Int.dpToPx(context: Context): Int {
    val density = context.resources.displayMetrics.density
    return (this * density + 0.5f).toInt()
}

// 2. iOS Swift Extension (UIKit)
extension CGFloat {
    var toPixels: CGFloat {
        return self * UIScreen.main.scale
    }
}
03

Step-by-Step: Designing an Adaptive Card Component from Figma to Code

Step 1: Determine your design tool baseline. Figma typically uses an iOS 393 x 852 pt frame or Android 360 x 800 dp frame. Step 2: Input your base component measurements into the density calculator (e.g., 16dp outer margin, 48dp minimum touch button height, 18sp headline text). Step 3: Review the live multi-density matrix to verify raster asset sizes required for design handoff (mdpi: 48px, hdpi: 72px, xhdpi: 96px, xxhdpi: 144px, xxxhdpi: 192px). Step 4: Simulate Android Accessibility font scaling (1.3x and 2.0x) to confirm text containers expand without clipping. Step 5: Copy ready-to-use SwiftUI and Jetpack Compose code snippets directly into your UI codebase.

Implementation example
// Native UI implementation: Scaled 48dp touch target and padding

// 1. Jetpack Compose (Kotlin)
@Composable
fun ActionButton(text: String, onClick: () -> Unit) {
    Button(
        onClick = onClick,
        modifier = Modifier
            .fillMaxWidth()
            .height(48.dp) // Auto-scales across density buckets
            .padding(horizontal = 16.dp)
    ) {
        Text(text = text, fontSize = 16.sp) // Respects Dynamic Text scaling
    }
}

// 2. SwiftUI (iOS)
struct ActionButtonView: View {
    var body: some View {
        Button(action: {}) {
            Text("Continue")
                .font(.system(size: 16, weight: .semibold))
                .frame(maxWidth: .infinity)
                .frame(height: 48) // In Points (PT)
        }
        .padding(.horizontal, 16)
    }
}
04

Handling Dynamic Type and Screen Density Programmatically in Mobile Codebases

Modern mobile accessibility requires apps to gracefully support user-configured text scaling. In Android, SP (Scale-independent Pixels) scales dynamically with user font preferences in device Settings. In iOS, Dynamic Type adjusts point sizes based on UIFontMetrics. Testing text components under 200% font scale prevents layout clipping and overlapping labels.

Implementation example
// React Native & Flutter device pixel ratio helpers

// 1. React Native PixelRatio
import { PixelRatio } from 'react-native';
const dpValue = 24;
const physicalPx = PixelRatio.getPixelSizeForLayoutSize(dpValue);
const fontScale = PixelRatio.getFontScale(); // e.g., 1.5 for large text

// 2. Flutter MediaQuery
import 'package:flutter/material.dart';
Widget build(BuildContext context) {
  final pixelRatio = MediaQuery.of(context).devicePixelRatio;
  final textScale = MediaQuery.textScalerOf(context);
  return Container(width: 48.0); // 48 logical pixels
}
05

Touch Target Guidelines (WCAG / Material / HIG) & Local Processing

Both Apple Human Interface Guidelines (HIG) and Google Material Design enforce minimum touch target dimensions to ensure accessibility: Apple mandates a minimum 44 x 44 pt interactive target, Google Material 3 mandates 48 x 48 dp (at least 7mm x 7mm physically), and WCAG 2.2 Level AAA Target Size requires at least 44 x 44 CSS pixels. WebCraftKit density calculations run 100% locally in your browser with instant mathematical accuracy and zero tracking.

Knowledge base & clarifications

Frequently Asked Questions: DPI & DP Calculator

Got questions about how DPI & DP Calculator operates, client-side cryptographic safety, or performance limits? Explore common answers below.

What is the difference between DP (Android) and PT (iOS)?

Both are abstract units for resolution independence. Android DP (Density-independent Pixel) is anchored to a 160 DPI baseline (1dp = 1px at mdpi). iOS PT (Point) is anchored to a 163 PPI baseline (1pt = 1px on legacy non-Retina displays). Conceptually, 1dp is approximately equal to 1pt.

Why should mobile text sizes always use SP on Android instead of DP?

SP (Scale-independent Pixels) scales proportionally with the user's preferred font size configured in Android System Settings (Accessibility). Using DP for text freezes typography sizes, breaking accessibility for vision-impaired users.

What is the formula for converting DP to PX?

The formula is: `px = dp * (dpi / 160)`. For example, a 16dp margin on an xxhdpi screen (480 dpi) equals `16 * (480 / 160) = 48px`.

What are the recommended minimum touch target sizes on iOS and Android?

Apple Human Interface Guidelines (HIG) recommends a minimum tappable area of 44 x 44 pt. Google Material Design 3 recommends a minimum interactive target size of 48 x 48 dp.

Does this calculator send my screen dimensions or device specifications to any remote server?

No. All density conversions, PPI calculations, aspect ratio derivations, and code generations are computed client-side using JavaScript in your browser with zero network requests.

Complementary utilities
View all in Mobile & Apps →