Software maintenance constitutes a significant fraction of the software budget. The cost of maintaining old applications has been escalating and this trend is likely to continue in the foreseeable future. The study of software maintenance strategies has become important to both researchers and practitioners in Information Systems. While there is a rich literature on the technical aspects of software maintenance, research on the economics of maintenance is in its infancy. In particular, the tradeoffs between maintaining and rewriting old software have not been investigated from a theoretical standpoint. In this paper, we present an economic model of the software replacement problem. Based on available empirical evidence, we hypothesize that, with frequent modifications and enhancements, the complexity of software increases rapidly. This deterioration of the code leads to a sharp increase in the maintenance cost. Thus, there may exist a time when it is optimal (in an economic sense) to rewrite the system, which reduces the system complexity and the subsequent maintenance cost. The proposed model allows us to compare the economics of various rewriting strategies and to determine the optimal rewriting point(s). Some interesting results with implications for the systems manager are obtained from the analysis. These include the impacts of system size, structuredness of the underlying technology, and the availability of superior technologies upon the rewriting point(s) and life cycle costs. A numerical example is provided to demonstrate the applicability of the model.