The back of a smartphone showing a camera module with three round lenses

The short version

Every digital camera, whatever its size, does the same four things. A lens gathers light and focuses it into an image. A sensor turns that light into electrical signals. A processor turns the signals into a picture. Software saves the picture as a file. A phone squeezes all four into a slab a few millimeters thick.

The three basic parts people usually name are the lens, the image sensor and the processing chip. Autofocus hardware and stabilization are extra parts that help the first two do their job in a handheld device.

Light enters the lens

A phone lens is a stack of several small plastic or glass elements. Together they bend the light from a scene so that it lands sharply on the sensor. Because the stack must fit inside a thin body, the lens is short, and the sensor behind it is small compared with the sensor in a dedicated camera.

Most phone lenses have a fixed aperture, the opening that lets light in. Instead of closing a diaphragm to change exposure, the phone changes how long the sensor collects light and how strongly it amplifies the signal. Many phones carry more than one lens, for example a main, a wide and a telephoto module, each with its own sensor, and the phone switches between them or blends them.

The sensor and its color filter

The image sensor is a grid of tiny light-sensitive spots called photosites, usually described as pixels. Almost all phone sensors are the CMOS type. Each photosite collects light during the exposure and turns it into a small electrical charge, and the charge is converted into a number.

A photosite alone only measures how much light arrived, not what color it was. To capture color, a color filter array sits over the sensor. The common layout is the Bayer pattern: each photosite is covered by a red, green or blue filter, in a repeating block with two green photosites for each red and each blue. The raw data is therefore a mosaic in which every position knows only one color.

Above the filters sits a layer of microlenses, one per photosite, which funnel light into each tiny well. Under the sensor, converters turn the analog signal into digital values, and the data is read out row by row.

From raw data to a photo

The mosaic has to become a normal picture. A chip called the image signal processor, often part of the main phone processor, does this in a fixed order of steps. It fills in the two missing colors at each position by looking at neighbours, a step called demosaicing. It reduces noise, corrects the white balance so a white wall looks white under any lamp, adjusts contrast and color, and sharpens edges.

The result is saved as a JPEG or HEIF file. Some phones can also save the less processed raw data, which keeps more room for editing but looks flat until you adjust it yourself.

Autofocus and stabilization

To focus, phones compare the light that reaches different parts of each photosite or use dedicated focus pixels, a method called phase detection. Some also use a small laser or time-of-flight sensor to measure distance in dim light. Contrast detection, which looks for the sharpest version of the image, is often used as a backup.

To keep pictures sharp when your hand shakes, many phones move the lens or the sensor with tiny magnets, called optical image stabilization, and many also stabilize video by cropping and shifting the frame in software.

Why a tiny camera needs software

A small sensor collects less light than a big one, so single frames from a phone are noisier and have less range between the darkest and brightest parts. Phones answer by taking several frames and combining them. That approach has its own name and its own guide: computational photography.

To judge the hardware side, two numbers help most: the physical size of the sensor, explained in the sensor size guide, and the pixel count, covered in the megapixels guide.