How To Calculate A Display's Pixel Density (ppi / Pixels Per Inch) By Yourself And What Is Pixel Density
Definition
Pixel density is a metric telling us how many pixels there are in a fixed area of a display. It's a very important metric because it lets us know how closely packed the pixels on a display are. This is something that determines the quality, clarity, and readability of the image displayed. It is usually measured in a unit called pixels per inch (ppi).
Very often, when we are confronted with evaluating the quality of a display and/or comparing two or more displays together, we don't have all the information available. Something that is often missing is the pixel density, which is actually a very important metric and can provide us with valuable information about the picture quality we could expect. But we almost always know the size (diagonal) of the screen given in inches and the resolution. Having this information we could easily calculate the pixel density ourselves.
Calculation
If we have two displays with the same resolution, the smaller one will have the higher pixel density. And if we have displays with the same size, the one with a higher resolution will have the higher pixel density. So it's clear that the two parameters that we need in order to calculate the pixel density are display size and resolution.
Pixel Density Formula
Using the right units
You need to make sure you are using the right units in order to get the right result in the expected unit. If there are units that don't fit, they need to be converted.

Resolution  number of pixels (usually not specially denoted)

Display Size (diagonal)  inches

Pixel Density  pixels per inch
Other useful resources
 Display (Screen) Resolutions  What Does Resolution And Aspect Ratio Mean?
A quick and easy guide to display resolutions and aspect ratios helping you understand the logic and abbreviations. Detailed information on all the industry standards used in smartphone, tablet, TV and computer monitor displays.
First you need to calculate the diagonal resolution and then divide it by the size (diagonal in inches) of the display. The diagonal resolution is the square root of the sum of the squares of the squares of the two multiples of the resolution (width and length). In order to make it sound and look easier to understand we can put this all together into a single formula that you can see on Figure 1.
If you don't have information about the diagonal of the screen, you an always calculate it using the Pythagorean Theorem using its length and the width. The diagonal is the square root of the sum of the squares of the length and the width. Diagonal = square root of (width^{2} + length^{2}).
Example 1 (textual)
Let's say we have a smartphone with a 4.5 inch display and a resolution of 768x1280. It means that we have all the parameters we need to do the calculation: width=768; length=1280 and display size=4.5 inch. First we are going to determine the the diagonal resolution by calculating the square root of 768^{2} + 1280^{2}. 768^{2} + 1280^{2} = 589824 + 1638400 = 2228224 and the square root of that is about 1492.7. This is a the diagonal resolution which we now divide by the diagonal 4.5 inches and get the answer of roughly 332ppi, which is a really outstanding result for a smartphone.
Example 2 (mathematical)
Let's say we have a computer display that is 21.5 inch with a 1920×1080 resolution.
display size = 21.5inch
width = 1920
length = 1080
diagonal resolution = square root of (1920^{2} + 1080^{2})
diagonal resolution = square root of (3686400 + 1166400)
diagonal resolution = square root of 4852800
diagonal resolution = 2203 (close approximation)
pixel density = diagonal resolution / display size
pixel density = 2203 / 21.5
pixel density = 103ppi (close approximation)
Comments
Thanks a lot for taking the time out for explaining this. The article is extremely well written and lucidly explained. Great job.
Why do the vertical and horizontal resolutions have to be squared and then the square root of that taken?
PIXEL DENSITY = 2203 / 21.5
this is incorrect.
I hear my tech students talking about this on occasion. Now, I can talk to then with understanding.. won't they be shocked!
6