While you can technically substitute margarine for butter, I don't recommend it because it will alter the texture and flavor of the cookies. If using margarine, choose one with a high-fat content, as lower-fat margarines may result in cookies that spread too much.