Whatsapp does not allow users to control their online or offline status.
Users who want to use the Whatsapp in “offline mode,” there are solutions to this problem.
First Disable Internet Connection (wifi) or enable Airplane mode to immediately disable all active network connections.
Android: Start WhatsApp and press the three vertical dots in the upper right corner, then select Settings.
iPhone: Launch WhatsApp and select the Settings tab.
Go to Account > Privacy > Status. Select the Share only with… option and do not select any contacts. Save your changes and press Done.
You also hides the timestamp of your last use of WhatsApp.
Finally, if you have Live Locating turned on, turn it off, To reappear online, simply repeat the previous steps by re-enabling the disabled options.
alternatively you can download “Hide Unseen Online” app from Google play store. by having this app you can easily hide your online whatsapp status.