# Calculate pixels to cm with dpi

Can someone please tell me the formula used on this online cm to pixel calculator? https://photoresizer.net/pixel-calculator

I have images that I can easily get the dpi, bit-depth, pixel height and width, and I need to calculate the print centimeter dimensions of the images. For example, If a 300-dpi, 8-bit image has pixel dimensions of 9448x3543, the calculator should give me 80x30 cm as shown in the screenshot below.

I actually need a pixel-to-cm formula and the calculator in the link above only does cm-to-pixels but if I knew the formula, I can easily reverse it.

NOTE: I notice that if you divide the width or height by 118.1 it gives the correct result (9448 \ 118.1 = 80) but I don't understand why that would be the formula and if it's the correct number to get correct results with ALL sizes. What's the relation with the number 118.1? • I would just like to point out that the foemula is in the name. DPI = Dots per . Dots in this case is pixels. And offcourse 300 dots per inch is 118 dots per cm. See here Dec 24, 2020 at 6:52
• size in cm = 2.54*x/ppi, where x is a value in pixels. 300ppi/2.54 = 118.1ppcm, because 1 inch=2.54cm Dec 24, 2020 at 12:23

DPI = Number of pixels / Length in inches = N/(Lin).

Reversed formula: Lin = N/(DPI)

BTW. The linked calculator outputs another equivalent reversed form: N=(Lin)*(DPI)

Inches converted to centimeters: Length as centimeters = 25.4 * Length as inches or as well Lcm = 25.4 * (Lin)

==> your actually wanted formula Lcm = 2.54 * N/(DPI)

test: 300 DPI and 600 pixels give Lcm = 2.54 * 600/300 = 2.54 * 2 centimeters = 5.08 centimeters. That's 2 inches.

The number 118.1 is 300 divided by 2.54 That's 300 DPI converted to pixels per one centimeter.

Note: Often paper sizes are rounded to the nearest full millimeter. In this case it would be 51 millimeters or 5.1 centimeters. But the exact result based on the agreement how much one inch is in metric system is 5.08 cm.