A pixel has no size of its own
An image is a grid of pixels — 3,000 × 2,000, say — and nothing in that grid says how big a pixel is. Size only appears once you decide how many pixels go into an inch: the DPI (dots per inch) or PPI (pixels per inch). At 300 DPI, 3,000 pixels print 10 inches wide; at 150 DPI, the same pixels print 20 inches wide. Changing the DPI setting in an image file changes neither the pixels nor the file's quality, only the size it prints at.
The formulas
Inches = pixels ÷ DPI, and pixels = inches × DPI. One inch is exactly 2.54 cm, or 25.4 mm. So inches to pixels at 300 DPI is a multiplication by 300, and pixels to cm is pixels ÷ DPI × 2.54.
Which DPI to use
300 DPI is the usual figure for photos and print viewed up close; 150 is often enough for posters seen from a distance; 600 is used for line art and detailed scans. 96 is the CSS reference pixel — web browsers treat 96 CSS pixels as one inch — and 72 is an old Mac and Photoshop default that still appears in image metadata. A print shop or publisher may specify its own figure; use that.
Pixels needed for a print
The print-size box multiplies width and height by the DPI and rounds up to whole pixels, so the image always covers the paper. An 8 × 10 inch print at 300 DPI needs 2,400 × 3,000 pixels (7.2 megapixels). In centimetres the division rarely comes out even: A4 (21 × 29.7 cm) at 300 DPI comes to 2,481 × 3,508 pixels here, because 2,480.3 rounds up.