Screen Density Calculator
Calculate DPI/PPI and determine density buckets for mobile devices
Understanding Screen Density
Screen density refers to the number of pixels within a physical area of the screen, typically measured as pixels per inch (PPI) or dots per inch (DPI). Higher density screens display sharper, more detailed images.
Key Concepts
PPI (Pixels Per Inch)
The number of pixels that fit into one inch of the screen. Calculated using the screen resolution and physical size:
PPI = √(width² + height²) / diagonal size
DPI (Dots Per Inch)
Technically different from PPI (used for printers), but the terms are often used interchangeably for screens. For mobile development, PPI is the more accurate term.
Density-Independent Pixels (DP/PT)
A virtual pixel unit that allows you to define UI elements in a way that's independent of screen density:
- Android: DP (density-independent pixels)
- iOS: PT (points)
Physical Pixels = DP × Density Ratio
Android Density Buckets
Android groups devices into density buckets to simplify resource management:
| Bucket | Qualifier | Ratio | PPI Range | Example |
|---|---|---|---|---|
| ldpi | ldpi | 0.75x | ~120 PPI | Older devices |
| mdpi | mdpi | 1.0x | ~160 PPI | Baseline density |
| hdpi | hdpi | 1.5x | ~240 PPI | Budget phones |
| xhdpi | xhdpi | 2.0x | ~320 PPI | Most smartphones |
| xxhdpi | xxhdpi | 3.0x | ~480 PPI | High-end phones |
| xxxhdpi | xxxhdpi | 4.0x | ~640 PPI | Premium devices |
iOS Scale Factors
iOS uses a simpler scale factor system:
| Scale | Multiplier | Examples |
|---|---|---|
| @1x | 1x | iPhone 3GS and earlier, iPad 2 |
| @2x | 2x | iPhone 4-8, iPhone SE, iPad (3rd gen+) |
| @3x | 3x | iPhone 6 Plus and later Plus/Pro Max models |
Providing Graphics Assets
Android
Place drawable resources in density-specific folders:
res/ drawable-ldpi/ drawable-mdpi/ drawable-hdpi/ drawable-xhdpi/ drawable-xxhdpi/ drawable-xxxhdpi/
iOS
Use naming conventions for different scales:
image.png (1x - 100×100) image@2x.png (2x - 200×200) image@3x.png (3x - 300×300)
Best Practices
- Design at the highest density: Start with xxxhdpi (4x) or @3x and scale down
- Use vector graphics: SVG on Android (VectorDrawable), PDF on iOS
- Test on multiple devices: Verify appearance across different densities
- Optimize file sizes: Use appropriate compression for bitmap images
- Use DP/PT for layouts: Never use pixels for sizing UI elements
Common Devices
iPhone
- iPhone 14 Pro: 460 PPI (@3x)
- iPhone 14: 460 PPI (@3x)
- iPhone SE: 326 PPI (@2x)
Android
- Pixel 7 Pro: 512 PPI (xxxhdpi)
- Galaxy S23: 425 PPI (xxhdpi)
- Budget phones: ~220 PPI (hdpi)
Quick Tips
- Always design in DP/PT, not pixels
- Provide assets for all density buckets
- Use 1dp = 1px at mdpi (160 PPI)
- Test on physical devices
- Consider using vector graphics