Discussion. We proposed a computational framework for determining optimal sizing and operations electrified units that provide synthesis gas to a methanol synthesis process. The economic viability of such a system is affected by the local energy market, the type of energy market that it participates in, and the operation mode of the system (flexible and inflexible). We found that it is economically viable to retrofit an existing methanol plant with a flexible electrification unit under electricity markets that have sufficiently low average prices and sufficiently high frequency of negative prices. Our results also indicate that hydrogen can be produced at a lower cost than SMR with flexible electrolysis units. Our results also indicate that flexibility is a key asset that needs to be considered in process design. For instance, we find that participating in the RTM consistently outperforms participation in the DAM. To take advantage of RTM volatility, the proposed electrification system is required to switch its production load every 15mins. We also observed that the economy of this system is more sensitive to the electrolyzer equipment cost than its energy efficiency; this suggests that reducing the manufacturing cost of electrolyzer is more promising than improving its efficiency.