Both forms are correct. Whilst and while are two conjunctions that can substitute each other in the sentence. While is the more common and less formal form and whilst is the more formal version used mainly in British English. Although as conjunctions both forms differ only in the tone of the speech, while can also be used as a noun and in that case cannot be replaced by whilst.

Correct spelling


Correct spelling, explanation: British, more sophisticated version of while.

Correct spelling


Correct spelling, explanation: more commonly known and used form.

Definition of while/whilst:
conjunction: during the time;
I listened to this podcast you recommended whilst I was driving home.
– although, despite, of;
While I admire your dedication to the case, sometimes it is better to think about yourself.
– on the other hand;
While I like this bright color, I have to wear something more appropriate.
– throughout the time;
Whilst he is breathing, there is still hope he will live.
While (noun): some length of time;
I can only stay for a while, I have a few more things to do.