You may be photographing in raw rather than jpeg because you know that raw files contain more information and because they are unprocessed, giving you more flexibility. But how do they contain more information? Among other things, digital photography raw files are captured at a higher bit depth — depending on the camera, 12, 14 or 16 bit, compared to 8 bit for jpegs. Whether 12, 14 or 16, these higher bit-depth files potentially contain much more information than 8 bit files.
So what is bit depth?
For each pixel in your image, the tonal value or brightness of the scene you are photographing is stored in the image file on your memory card, along with the color. Computer files store information in zeros and ones. Bit depth refers to how many digits the tonal information for each pixel is stored in. Imagine if your camera used a bit-depth of one: you would have one digit to store how dark each piece of the scene was, the only possible values would be 0 and 1, and the only two tones that could be represented are black and white:
This image of course has very little detail, since it contains no shades of gray.
If the file had a bit depth of two, there would be two digits, and the four values of 00, 01, 10, and 11 would be possible, so the image could have black, dark gray, light gray, and white:
Notice that we have gained some detail, but that the image is still very choppy. In the histogram for this image, below, we see huge gaps between the tones, confirming the choppiness or posterization. (The histogram is a graph of the tones in an image, going from pure black on the left side to pure white on the right side.)