Whales fill their mouth wide open with water and spit it out through their baleens, a set of comb-like teeths that filter out everything smaller than a krill. Krills are 1-2 centimeters long and they feed on plankton much smaller than that, so it gets filtered out.
Interestingly there is no clear difference between krill and plankton. Krill are small crustacean animals, while plankton encompasses all organisms, animal or algae or protozoan (including jellyfish), that float passively in a body of water, as opposed to nektons, who swim actively. Altough most krills are nektons, some species, such as amphionides, are plankton.