The short answer
Dimensions are the number of pixels across and down. File size is the number of bytes the saved file takes up, which depends on the pixel count, the format and the quality setting. DPI is a note about how large to print the picture, and changing it on its own leaves the pixels as they were.
Dimensions: the pixel count
A digital picture is a grid of coloured squares. Its dimensions are the width and height of that grid, written as something like 4000 by 3000. Multiply the two and you have the total: twelve million pixels in this case, or 12 megapixels. The megapixel figure quoted for a camera is this same total. Dimensions say how much detail the picture can hold. They say nothing about how much room it takes on a disk.
File size: what the pixels cost to store
File size is measured in bytes, usually shown as KB or MB. Two pictures with identical dimensions can differ greatly here, for three reasons: the format they are saved in, the quality setting used, and what they show. A plain blue sky is cheap to store. A crowd, a gravel path or a tree in leaf is expensive, because there is more to describe.
This is why no formula turns pixel dimensions into kilobytes. The only way to know is to save the file and look.
DPI: an instruction for the printer
DPI, or PPI, is a number stored beside the picture saying how many pixels should fill one inch of paper. A picture 3000 pixels wide prints 10 inches wide at 300 per inch and 20 inches wide at 150. The pixels are the same in both cases; only the spread on paper differs. Editing the DPI number in an image program, with resampling switched off, changes that note and nothing else.
On a web page the number generally plays no part. The page decides how big to draw a picture from its pixel dimensions and its own layout. Some desktop programs, such as word processors, do read it when placing a picture on a page.
Which one are you being asked for?
- A limit in KB or MB is about file size. Use the Compress image tool, choose Target size and type the limit in KB.
- A requirement such as no more than 1200 pixels wide is about dimensions. Use the Resize image tool and type the figure into Max width, or into Max height for a limit on height.
- A request for 300 DPI is usually a request for enough pixels. Multiply the print size in inches by the DPI figure to find the pixel dimensions you need.
Changing one without the other
To cut the bytes and keep the pixel dimensions, compress. The Balanced setting or the Custom quality slider re-encodes a JPG, WebP or AVIF at the same width and height. To cut the pixels, resize by Scale or by a maximum width or height; the file size normally falls as well, because there is less to store.
The two meet in one place. When a Target size is too small to reach by lowering quality alone, the tool reduces the pixel dimensions in steps and says so in the result. And no setting makes a picture larger in pixels than it started, because the tools never enlarge.