The spatiotemporal variability of rainfall, particularly in the context of climate change, has been imperative for examining the cropping patterns, farming sustainable crop production, and food security in rainfed areas. To that end, trend analysis was done to study the change in rainfall patterns in the mid-hills of Himachal Pradesh. The study investigated the historical rainfall data from 1971 to 2020 on a monthly, annual, seasonal, and decadal basis by using the variability analysis methods, viz., standard deviation (SD), coefficient of variance (CV), and transformed annual precipitation departure (Z). The trend analysis was also done by Mann–Kendall (MK) and Sen's slope estimator (SSE) test and linear regression model. The annual rainfall in the region was 1115.1 mm, which showed a decreasing trend (Z = − 0.79 mm/year). Based on the linear regression model, the decrease in annual rainfall was about − 2.28 mm/year. The monthly and seasonal variability of rainfall exhibited a sensitivity to change. The months of January, April, July, and September showed an increasing trend, whereas the rest of the other months showed a decreasing trend. The seasonal rainfall (summer, monsoon, and post-monsoon) showed a decreasing trend, whereas the winter season depicted an increasing trend. During the entire study period, 1988 recorded as the wettest year, with highest annual rainfall of about 2205.0 mm and monsoon rainfall of about 1653.0 mm. The highest annual (2205.0 mm) and monsoon (1653.0 mm) rainfall was recorded in the year 1988. The decadal analysis of the rainfall on an annual basis revealed a decrease in rainfall during the periods 1971–1980, 2001–2010, and 2011–2020 as compared to 1981–1990 and 1991–2000. The rainfall over the study region confirms the strength of the change in trend. Thus, the erratic rainfall pattern makes the cropping calendar shorter and affects the agricultural productivity. [ABSTRACT FROM AUTHOR]