Every camera has a sensor to capture light. The light captured on the sensor is what forms the image. A camera sensor is made up of millions of light collecting dots called pixels. Each dot captures an individual spot of light.
If your camera has 18 megapixels, this means it has 18,000,000 of these light collecting spots on its sensor. When these dots are all viewed together, that’s when you see the image.
Here’s a simplified and magnified picture of the light collecting dots on a sensor.
Because a camera sensor has millions of pixels it is able to capture lots of detail and colour, like this:
However, if the sensor only had a few hundred pixels it would create a very low resolution image like this:
More pixels means more resolution; and sensor resolution is one factor that impacts on how clear and sharp your photos appear to be.