Following up from a previous related raw file latitude question. Why do RAW files record in 14 bit but only show 8 bit of data? The remaining data is hidden away to the right or left of the histogram. Therefore some details are lost without manual manipulation. Why not just show all 14bit to start with?
The issue has nothing to do with bit-depth but with how much dynamic-range is shown.
RAW files record a certain number of bits per photosite. This is usually 12 or 14 bits. JPEG images offer a fixed bit-depth of 8-bits per color-component. What nearly all cameras do is create a JPEG preview for the RAW file and compute the histogram based on that preview. This shows the correct histogram for JPEG images. If you shoot RAW+JPEG, it is also correct for the JPEG one. For those who shoot exclusively RAW, then obviously the histogram ends up being incorrect.
The discrepancy has to do with how the JPEG preview is rendered which is affected by image parameters. The lower the contrast, the more dynamic-range gets preserved in the 8-bits of space. In theory, one could show the entire range in a histogram but most cameras do not support contrast that low since compressing a high bit-depth image into 8-bit of space with no clipping would make it look extremely dull.
There is no camera screen that can show even 12 bits, since the horizontal resolution is too low. The histogram is always made of buckets each represent more than one luminance or color value, in the case of RGB histograms. If one were simply to drop the lower bits from RAW data, we could have a perfectly representive 8-bit histogram for a RAW file but only one camera AFAIK does this. The issue is that most cameras drop values at the extremes of the RAW values and map the rest to an 8-bit space which is what happens when producing a JPEG image out of RAW data.
Well, you could open the raw file in a hex editor and read the 14bit values as 0x0000h-0x3FFFh if you like to have the "raw show you the 14bit data".
Alternatively you can map the entire range linearly to be viewed on your 8bit display, so there is no cuts in either end:
Now, that looks really boring. How abuot we apply 2.2 gamma curve to make use of how the monitor and eyes work together:
A bit better, but still not pleasing. Let's do some basic "photo developing" such as auto clipping and colour space conversion (sRGB):
Virtually all computer, tablet, smart phone, etc. displays are limited to 24 bit color (8 bits per each of the Red, Green, and Blue channels). When an application displays an image file on such a screen, it has to either:
Choose an 8 bit zone of the original 12 to 14 bit data to display, with the brighter tones blown out and the darker tones pure black
Compress all of the Dynamic range of the original file into the 8 bit space, which makes the image look very dull and flat
Use a combination of the two methods above
Since your original question deals with histograms, we'll assume you also are referring to them here. The histogram on the back of the camera is based on the image rendered on screen, not the original RAW file. I suppose it would be possible for the camera to display a histogram based on the full dynamic range of an image file, but it would reduce the overall speed of the camera, since the camera would in effect now have to produce two different preview images for each file: one to display and another to base the histogram on. It would also require a higher resolution LCD on the back of the camera. There are probably dozens if not hundreds or thousands of potential buyers more concerned with frames per second (fps) and buffer depth compared to the number of potential buyers more concerned with the on-camera histogram displaying the entire dynamic range of a RAW image file. Which way do you think the designers are going to go with their products?
The LCD display on the back of your camera is designed to make every picture you take look as good as it possibly can. In other words, it lies like a politician! If you are viewing a 25 MP image on a 1MP screen it means that each pixel on the screen is displaying a combined 5X5 pixel area of the original image. Your focus could be blurred by as much as the width of four pixels and you wouldn't be able to tell a difference from a perfectly sharp image! Likewise, the color and contrast are rendered in a way that the manufacturer thinks is most pleasing to the most potential buyers. If the preview picture on the LCD screen reduced contrast enough to display the entire dynamic range of the RAW file, no one who buys a camera based on how the picture they just took in the crappy light of the store looks on the back of the screen would ever leave the store with one.
Mostly because such a preview would be meaningless. When you go to do final output, you are virtually always outputting in 8 bit color and the display itself is 8 bit. Having a display that approximates final output is generally more useful that one that captures the whole amount of information stored. I suppose you can't tell immediately if highlights will be recoverable or not, but you get a far better idea of what a final output will look like and it doesn't require a much more expensive display to show it on.
Lots of technically correct information/ answers here, but I think you are misunderstanding histograms. Two issues:
If you are referring to the fact that displays sometimes show the number 256 - This is just a convenience. 256 is maximum exposure just before blow-out for notional 8 bit capturing. Key is that images with more bits per channel will just have detail between the whole numbers down to 0. Think of it like scaling on scale of 0 to 255.
If referring to displays with the normally 5 areas - these show stops of exposure. This makes the histogram log scaled. I.e. reading from the right. One line back will be one stop less... so 128 on our nominal 256 scale, next line will be 64, etc. last one is 8. so if it was truly an 8 bit image you only have 8 levels available for thing 5 stops below full exposure. This explains why low bit images have limited to exposure correction possibilities.
So in short. 256 is sometimes just used as a nominal scale even though there might be more bits. If referring to the 5 stops shown in histogram: higher bit images will have more detail at these light levels, but for 99% of exposures you will just have (close to) zero readings on histogram for these.