The article presents an economic and mathematical model for optimizing the storage time of grain crops at the port elevator, taking into account price dynamics during the marketing year and the duration of grain storage in the port. The production of grain, its consumption and sale throughout the year, as well as the need for stocks of food, feed and seed funds, lead to the fact that some batches of grain are quickly spent on current needs or moved to places of consumption, while others are stored for a long time.Thus, grain storage can be short-term (from several days to one month) and long-term (more than one month).For the cargo owner, the issue of preserving the crop and the possibility of storing it until the most favorable prices are established on the grain market is important. Therefore, competent management of the duration of storage of the grain harvest is essential for the successful operation of the grain trader. The decision of the owner of the cargo when to sell his grain depends on the duration of the pre-sale storage of this grain (and therefore the costs associated with it), and its selling price on the market.Given the above, the cargo owner must develop a strategy for the sale of grain crops, taking into account the world market conditions, their own capabilities and tasks.The target function of the model for optimizing the shelf life of grain is the profit from the sale of these goods minus the costs of their storage and processing. In addition, the model takes into account the costs of processing and storing grain, a parameter that determines the acceleration of the growth of costs for grain storage with an increase in the duration of storage, the total duration of shipment/loading of grain, analysis, drying, processing, and the total duration of grain stay at the port elevator from the moment of its loading on the elevator until loading onto the vessel. Having a number of advantages, this model can be used by cargo owners, heads of stevedoring companies to make managerial decisions to determine the optimal period of stay at their own storage areas for reloaded grain.Keywords: optimization model, grain crops, storage time, price dynamics, port elevator.