In logic, a counterexample is a statement that defeats a universal claim by showing it to be false in some instance.
Consider the claim “all swans are white”. This claim can be disproven by means of a counterexample — a single black swan. Also consider the claim “no mammals lay eggs”. Such a claim can be disproven by demonstrating a monotreme, for example, a platypus. In both cases, the initial claim is universal — it has to do with all entities of a certain group. The counterexample shows that at least one entity of that group doesn't fit the description, and so the universal claim must be false.
A counterexample can also be a counterexample to an argument. With respect to arguments, a counterexample is a case that shows that the argument is invalid — that is, a case (hypothetical or otherwise) where the premises are true and the conclusion is false.
In formal logic, a counterexample to an argument form is a valuation which shows that argument form to be invalid.