Have the screen resolution (width and height) in pixels and the diagonal length in inches, and want to calculate the PPI? Pretty simple really. Let’s use a concrete example. The iPad 4 has a screen resolution of 2048 by 1536 pixels, and a diagonal length of 9.7 inches. Thus we calculate its PPI as
The calculation above was performed using the wonderful MyScript Calculator, and the result captured by taking a screenshot.
Here’s the same formula using WordPress’ renderer, in a more generalized form: , where is the screen width in pixels, is the screen height in pixels, and is the diagonal length of the screen in inches.