Some liquids mix readily like perfect partners. Alcoholic beverages like whiskey, wine and beer, for example, are all mixtures of water and alcohol. Other liquids don't mix at all. If you shake a bottle full of oil and water, for instance, you can get them to mix but as soon as you return the bottle to the shelf, the two will separate. Liquids that don't mix and stay mixed are said to be immiscible.
Like Dissolves Like
Like dissolves like is a simple rule of thumb chemists use when evaluating how soluble a compound will probably be in a given solvent, and the same rule holds true for determining whether two liquids are miscible. The rule has to do with how atoms share electrons. Oxygen and nitrogen are much more selfish than carbon or hydrogen, so molecules that contain oxygen or nitrogen bonded to carbon or hydrogen feature regions where electrons are shared unevenly; this part of the molecule is said to be polar. Regions made predominantly of carbon and hydrogen, by contrast, are nonpolar because electrons here are shared more equally. A nitrogen or oxygen atom with a hydrogen atom attached to it is so polar it can form weak bonds called hydrogen bonds with oxygen or nitrogen atoms on other molecules.
Like dissolves like says that liquids will probably mix well if they have similar polarity and hydrogen-bonding ability. The more similar they are in terms of these two characteristics, the more likely it is they will mix well. Liquids that differ significantly in terms of these characteristics, by contrast, are likely to be immiscible.
Water and Hydrocarbon Solvents
Just as you'd expect from the like-dissolves-like principle, water and hydrocarbon-based solvents tend to be completely immiscible. Common examples include hexane (C6H14), toluene (C7H8) and cyclohexane (C6H12). Gasoline is a mixture of hydrocarbon solvents like hexane, which is why gasoline and water don't mix. Toluene is a common solvent in paint thinners and other industrial chemicals, and these typically mix poorly with water as well.
Water and Oil
Perhaps the most common example of immiscible liquids is oil and water. Vegetable oils are made from fats; these do contain oxygen atoms as part of a so-called ester group, but the oxygen atoms do not have hydrogens attached to them; so while these oxygen atoms can accept hydrogen bonds, they do not have a hydrogen they can use to form a hydrogen bond with another molecule. Also the vast majority of the fat molecule is hydrocarbon, so most of the molecule is nonpolar. That's why fat molecules tend to mix very poorly with water.
Methanol and Hydrocarbon Solvents
Just like water, other highly polar solvents tend to be immiscible with pure hydrocarbon solvents. Hexane, for example, will not mix with highly polar methanol (CH3OH) or glacial acetic acid (C2H4O2) because it has no ability to form hydrogen bonds with these molecules and is too nonpolar. Dimethyl sulfoxide is another polar solvent that mixes well with water but will not mix with hexane or cyclohexane and other common hydrocarbon solvents.