We develop a modeling and optimization framework to investigate membrane-based carbon capture from a natural gas power plant with flexible electricity output. The model jointly optimizes the design and time-varying operations of the power generation and membrane capture system to maximize net present value. We apply the optimization framework to a 400 MW natural gas combined cycle and a two-stage membrane cascade. The power plant responds to varying electricity prices under a set of constant CO2 prices. We found that the optimal design (membrane and equipment sizes) is a result of balancing capital and operating costs, and that the optimal operating schedule (electricity output, membrane operating pressure, CO2 capture rate) depends on the carbon price relative to the electricity price. A variety of exogenous input variables determine the optimal design of the membrane system and overall