TIFR-ARIES Near Infrared Spectrometer (TANSPEC) instrument provides simultaneous wavelength coverage from 0.55 to 2.5 $$\mu $$ m, mounted on India’s largest ground-based telescope, 3.6-m Devasthal Optical Telescope at Nainital, India. The TANSPEC offers three modes of observations, imaging with various filters, spectroscopy in the low-resolution prism mode with derived $$R\sim 100$$ –400 and the high-resolution cross-dispersed mode (XD-mode) with derived median $$R\sim 2750$$ for a slit of width 0.5 arcsec. In the XD-mode, 10 cross-dispersed orders are packed in the $$2048 \times 2048$$ pixels detector to cover the full wavelength regime. As the XD-mode is most utilized as well as for consistent data reduction for all orders and to reduce data reduction time, a dedicated pipeline is essential. In this paper, we present the code for the TANSPEC XD-mode data reduction, its workflow, input/output files and a showcase of its implementation on a particular dataset. This publicly available pipeline pyTANSPEC is fully developed in Python and includes nominal human intervention only for the quality assurance of the reduced data. Two customized configuration files are used to guide the data reduction. The pipeline creates a log file for all the fit files in a given data directory from its header, identifies correct frames (science, continuum and calibration lamps) based upon the user input, offers an option to the user for eyeballing and accepting/removing of the frames, does the cleaning of raw science frames and yields final wavelength calibrated spectra of all orders simultaneously.