Generally speaking, they have the same meaning. They both mean "alone".
However, in the sentences Dania provided, in my opinion, they have different meanings.
In my opinion, "I made this cake (all) by myself" means "I had no help while I was making the cake."
"I made this cake (all) on my own" could likewise mean "I had no help while I was making the cake" but in my opinion, it could also mean "I had no company while I was making the cake." It is ambiguous.
Personally, if I wanted to convey the meaning that I made a cake without help from anybody, I would always say "I made it all by myself". (without help).
I wouldn't say "I made it on my own" as this could be understood to mean "without company" (i.e. it could mean that I was alone in the kitchen while the cake was being made. No other persons were present. I was alone in the kitchen).
Regarding the degree of formality, In my opinion, both "my myself" and "on my own" are informal words that are most often used in colloquial speech.
If I wanted to use a more formal word, I would use "alone" or "unaccompanied" (to express the idea of not having company) or "unaided" (to express the idea of not having help).
If you are studying English "by myself," it could mean that you don't like the other people in your class, so you are sitting in a corner of the library, away from the other students.
If you are learning English with no teacher, we would normally say "I'm learning English on my own."
We would understand what you mean by context, regardless of which way you say it.
With other things, it's pretty much the same meaning:
I made this cake all by myself! = I made this cake on my own! These mean the same thing.
i don't think there's a difference? they're quite similar
" i made the this cake by myself"
" i made this cake on my own"
the second one just feels more formal to me and the first one more in use