- A megapixel is one million pixels. A pixel is a single site or spot on a digital image sensor that gathers photons of light, and converts these photons into electronic information. A single pixel is a single point of light, the smallest unit of measurement in a digital image. The pixels (and megapixels) cumulatively receive, "count" photons of light on a whole digital sensor, and convert the light into the electronic information that makes up a digital image.
Technical explanation of pixels and megapixels
Megapixels are an integral part of what makes up each image sensor in a digital camera. The more megapixels that a sensor has, the more that sensor is considered "high-resolution", and is potentially able to create a more detailed final image.
Many factors weigh into how detailed an image will look, of course, and other factors can work against a system overall, despite a high-megapixel sensor. For example, using a lens that is not sharp enough to fully resolve each megapixel on the sensor will result in a less detailed image. Also, using a higher ISO, or improper shooting technique in general, can result in loss of image sharpness, literally "wasting" megapixels.
Similarly, the size of the pixel itself will influence its quality, and therefore the overall quality of the final image that is recorded on the whole digital sensor. Basically, the width of a single pixel is measured in microns, (known as pixel pitch) and a smaller pixel will generally collect fewer photons than a larger one. (Say, 3.9 microns from a 24 megapixel APS-C sensor, instead of 8.4 microns from a full-frame 12 megapixel camera) Given the exact same sensor technology, the fewer photons that a sensor can gather, the less image quality it can potentially deliver.
It is difficult to quantitatively measure this difference, however, because there are many other factors that go into the collecting, counting, and converting of photons on a pixel level. All of the physical electronics involved, as well as the software or firmware that is handling the conversion process, can be different from sensor to sensor. For this reason, many different size sensors with different megapixel counts can be capable of either extremely good or extremely poor image quality.
Thankfully, generally speaking most modern digital sensors are all very good at counting and converting photons into the pixels of an image, from the tiny sensors found in cellular phones to the large sensors found in high-end professional digital cameras. Physics itself will always dictate that a larger pixel size will always give one sensor a potential advantage over another with smaller pixels, on a per-pixel level, however for most digital consumption needs, such as social media platforms, all modern digital cameras will produce stunning high-resolution images containing many megapixels of image data.
ABOVE: A full image from a 24 megapixel, full-frame camera.
RIGHT: A crop showing the actual pixel level, or 100% view.