You can safely freeze butter and margarine for up to a few months. One rule of thumb to remember: the higher the fat content, the better it freezes.