The answers you have received so far are right... and also wrong.
It is true that 'How are you doing?" is fairly informal: it's a more familiar way of asking the question 'How are you?'. This is a question about someone's health or wellbeing. A typical answer is 'Fine' or 'OK' or 'Not too bad'.
It is also true 'How do you do?' is formal. However, 'How do you do?' does NOT mean 'How are you?'. 'How do you do?' is NOT a way of asking how somebody is, and you do not answer with 'Fine', or with any other reply of that nature.
In fact, 'How do you do?' is used to mean 'I'm pleased to meet you', and the response - confusingly - is also 'How do you do?'. We use this the first time you meet someone in a formal context. For example:
A: Mr Suzuki, this is Mr Abbas from our Dubai office (to B)
B: How do you do, Mr Abbas? (to C)
C: How do you do, Mr Suzuki? (to B)
Most young native English speakers have never heard anyone say 'How do you do?', so they are unaware of its use.