Abbreviate a bachelor's degree with a "B" and then the abbreviation for the discipline the degree is in. A bachelor of science would be "B.S.," and a bachelor of arts would be "B.A." When listing the degree and major or emphasis area you would indicate "B.A. in music" or "B.S. in computer programming."
List a master's degree by using an "M" and a doctorate with a "D." A master of science degree would be abbreviated as "M.S." A doctor of education would be written as "Ed.D.," and a doctor of philosophy (a general term for many disciplines) would be "Ph.D." The law degree is a "J.D.," for juris doctor, and the medical degree is "M.D."
Use "Dr." before a name if you want to indicate that you have earned a doctorate. It is not customary for those who hold a juris doctorate to use this honorific. Ideally, one would not use both "Dr." and the degree title after the name; the degree title alone is usually more informative.