Hamlin was born in Paris, Maine. He was a descendant of James Hamlin who had lived in the Massachusetts Bay Colony in 1639. He attended the area's schools, and later managed his father's farm. For the next few years he worked at several jobs. He studied law. He lived in Hampden, where he practiced law until 1848, when he moved away.