Nowadays, the length of hospital stay index is utilized to analyze the use of services and the performance and efficiency of hospital activities. The current study was done to investigate the factors affecting the length of patients' stay in hospitals. The current study is descriptive-analytical and cross-sectional, and the research samples were selected by random sampling. The necessary data were extracted from the files of hospitalized patients. One-way ANOVA and T-test statistical tests were used to analyze the data, and regression analysis was used to investigate the simultaneous impact of independent variables on the average length of hospitalization. According to the obtained results, the factors of age, reasons for hospitalization, gender, type of insurance, marital status, type of referral, place of residence, and the condition at discharge were effective on the average duration of hospitalization. With increasing age, the average length of hospitalization increases. Also, the stay average length in men was longer than that of women, and the stay average length was shorter in people with recovery and partial recovery at the time of discharge. According to the findings of this study, measures are suggested to decrease the presence of elderly people in the hospital through nursing homes and home care development. Creating a referral system and developing a family doctor in the cities will also facilitate faster diagnosis of diseases, decrease unnecessary stays in the hospital, and shorten the treatment period.