Lignin extracted from black liquor in chemical pulp mills can potentially replace fossil carbon feedstocks in fuels and materials, thereby increasing the economic and environmental added values of woody biomass. However, since lignin extraction reduces the electricity generation of the mill, the added value depends on the characteristics of the electricity market in which the mill operates. In this study, a model mill is exposed to two different electricity price profiles: the low and steady prices of south-central Sweden in Year 2019; and the high and volatile prices of the same region in Year 2022. For the model mill, investments in lignin extraction designed to increase pulp production are economically viable and have low levels of sensitivity to electricity price levels and price volatility. The viability of lignin extraction without increased pulp production depends on the relationship between the electricity and lignin prices. With stable electricity prices, or steady mill operation, a rule-of-thumb holds that for lignin extraction to be viable, the lignin price (€/t) must be 1.8-times the average electricity price (€/MWh) plus 40 €/t for the supply of chemicals. With volatile electricity prices and flexible operation of the recovery boiler, the mill can shift the loss in electricity sales to low-price hours, thereby saving 15–70 % of the operational costs of lignin extraction, as compared to steady operation. This effect can be further enhanced by increasing the capacity of the lignin extraction process or extending the size of the black liquor storage tank. The proposed flexibility measures allow the market-integrated pulp mill to export lignin to replace fossil carbon supplies in other sectors, while supporting the electricity system during hours with high demand and low supply.