This invention provides for a compound of formula (I):or a pharmaceutically acceptable salt thereof, wherein R1-R4, n and p are defined herein. The compounds of formula (I) and pharmaceutically acceptable salts thereof are cationic lipids useful in the delivery of biologically active agents to cells and tissues.