This paper identifies the optimal restrictiveness of a financing covenant in a debt contract. We examine the decision of a debt-issuing company that has current operations as well as a future growth opportunity. The optimal financing covenant can substantially reduce the cost of debt financing, and generally allows the issuance of some debt for financing the expansion. Comparative static analysis indicates that the covenant is less likely to be included when growth opportunities, earnings volatility, earnings drift rate, interest rate and tax rate are higher; and when bankruptcy cost is lower. Also, the financing covenant is more likely when the leverage ratio is higher (bankruptcy risk is greater) but becomes less likely for very high leverage ratio (when the firm is in or close to financial distress). These results are generally consistent with existing empirical results in the literature.