A buffer is a solution which resists changes in pH when alkaline or acidic solution is added to it.
Buffers are created based on the equilibrium of a proton donor/ acceptor and the conjugate base/ acid. For example, a weak acid and it's salt can act as a buffer. The weak acid hardly dissociates whilst the salt fully dissociates to give a large concentration of ions. The weak acid and its dissociated ion then exist in equilibrium to resist changes in pH made by adding or withdrawing protons.