Nano and microsatellites have expanded the acquisition of satellite images with higher spatial, temporal, and spectral resolutions. Nevertheless, downlinking all this data to the ground for processing becomes challenging as the amount of remote sensing data rises. Custom onboard algorithms are designed to make real-time decisions and to prioritize and reduce the amount of data transmitted to the ground. However, these onboard algorithms frequently require cloud-free bottom-ofatmosphere surface reflectance estimations as inputs to operate. In this context, this paper presents DTACSNet, an onboard cloud detection and atmospheric correction processor based on lightweight Convolutional Neural Networks. DTACSNet provides cloud and cloud shadow masks and surface reflectance estimates 10x faster than the operational Sentinel-2 L2A processor in onboard hardware: 7 mins vs. 1 hour for a 10,980 x 10,980 scene. The DTACSNet cloud masking, based on a lightweight neural network, obtains the highest F2-score (0.81), followed by the state-of-the-art KappaMask (0.74), Fmask (0.72) and Sen2Cor v.2.8 (0.51) algorithms. Additionally, validation results on independent datasets show that DTACSNet can efficiently replicate Sen2Cor surface reflectance estimates, reporting a competitive accuracy with errors below 2%. Code is available at https://github.com/spaceml-org/DTACSNet.