The member of an old Shropshire family, Sandford was the son of Sir Daniel Sandford by Cecilia Catherine Charnock, daughter of John Charnock. He was the grandson of the Right Reverend Daniel Sandford, Bishop of Edinburgh, and the brother of Sir Herbert Sandford, Executive Commissioner to the Melbourne Exhibition of 1880, and the Right Reverend Daniel Sandford, Bishop of Tasmania. He was educated at the Glasgow High School, the Grange School at Sunderland, the University of Glasgow and as a Snell exhibitioner at Balliol College, Oxford, where he obtained a first class in "Literae Humaniores".