The Levels tool is an important tool for correcting the brightness levels in a picture. You can use this function to, for example, change a picture's "black point" and "white point" using a histogram. You can also use it to lighten or darken the midtones of a picture—to perform gamma correction.
To reach this window, use Edit | Adjust | Levels [Shift+L] in the Browser, or Adjust | Levels in the Editor.
Besides manual editing, you can also use it for automatic edits via the window's Automatically correct colors option. In the left part of the window, you can see a histogram preview and settings for manual edits. The Channel menu lets you choose which color channel to edit. RGB means the brightness channel. You can configure all these settings separately for each channel. The most basic settings when adjusting levels are the input and output levels and the gamma-correction coefficient. The gamma correction slider is located between the input values and output values. It determines colors' brightness in the midtones. All five values can be entered either directly using a number in the corresponding field, or visually, by clicking and dragging the corresponding triangle under the histogram and the brightness scale.
You can use the Black point and White point eyedroppers to select an input level for individual brightness elements by manually selecting a color directly from a preview pane. Clicking the brightest and darkest pixels in the picture generally gives the most useful white and black points.
When you turn on automatic mode, input levels for the individual channels are set automatically. When you use Automatic contrast, they are set the same for all channels. When you use Automatic levels, they are set for each channel independently. Automatic contrast "stretches" the brightness of the whole photograph to the maximum values, while Automatic levels "stretches" individual colors separately, and thus can change the picture's tinting. You can sometimes take advantage of this to remove tinting from a picture. The Target colors and cutoffs controls sets what colors to map the lightest and darkest areas to. The cutoffs aspect of it sets how much of the histogram should be cut off on the left and the right to ensure that the actual effective white and black points are used, rather than one of a few unrepresentative pixels that lie beyond them.