 His father served as British envoy extraordinary and minister plenipotentiary to Württemberg and the Colombia District (now Colombia) and was the fourth son of Sir James Cockburn, 8th Baronet (born c.1729, died July 1804), his three older uncles having died without heirs.He was initially educated largely abroad and became fluent in French and familiar with German, Italian and Spanish.He was educated at Trinity Hall, Cambridge, gaining a first in Civil law in 1824–5 and graduating in 1829 with an LL.B.