 Ainslie attended Eton College, where he captained the college cricket team, before undertaking studies at Magdalen College, Oxford.While at Oxford he played first-class cricket for Oxford University, making his debut against the Marylebone Cricket Club (MCC) at Bullingdon Green in 1843.He played first-class cricket for Oxford on seven further occasions up to 1845.