# How to calculate any screen’s pixel density

Pixel density is measured in PPI. PPI stands for **Pixels Per Inch**, it’s a measurement of resolution on any digital display. It measures how many pixels can be packed within 1 single inch of display.

We can say **the larger the PPI number, the more High Definition a display is**. That is because more pixels are packed in an inch of a display to represent anything that shows on a screen.

When you check a smartphone’s specification on GSMArena, you’d see that they provide PPI information for you to compare amongst other smartphones.

But do you ever wonder how that is calculated?

## PPI formula

When you think of the unit’s name, Pixels Per Inch, it should be quite straightforward right? Well, all you have to do is get **the total number of pixels of the screen and then divide it by the size of the screen in inches**. That makes the formula as follow:

## The screen size

But here’s the challenge: when you look at the information at GSMArena, it says 5.99 inches.

That doesn’t represent the height nor the width of your screen, because **screen sizes are always measured diagonally**. So when it says 5.99 inches there, it actually tells you the measurement from top corner to the other corner at the bottom.

## The pixels count

Now that we have the diagonal screen size in inches, we need the pixels count to be able to use the formula for PPI calculation. Let’s look back at GSMArena’s information, they do provide us the pixels count: 1080 x 2160 pixels. So we’re complete right?

No… we got the pixels count in height and width, and since we got the screen size in diagonal, **we need to get the pixels count in diagonal** as well. Ok… how exactly are we gonna do that then?

Enter** Pythagoras Theorem**, it has a formula that looks like this:

Basically you can punch in numbers of two sides and get the diagonal measurement out of it. I’m not gonna teach Mathematics here, so here’s the page to Wikipedia where you can read all about it.

So if we just assume the following, and punch in the numbers to calculator…

We’d get 2414.95, that would be the diagonal pixels count of the screen.

## The final calculation

Now that we have all the numbers we need, all that’s left is to punch in the numbers to the formulas:

**Screen size (in Diagonal)**: 5.99 inches

**Pixels count (in Diagonal)**: 2414.95 pixels

and … viola, we get the approximate PPI of a screen:

**Pixels Per Inch**: ~403 PPI

Let’s double check with the information on GSMArena…

Yeap, we got it! :)