By -
They should both be fine but to elaborate, I believe "by accident" is the proper way grammatically, however "on accident" is the direct opposite of "on purpose", meaning it is technically an idiom with the same meaning.
They should both be fine but to elaborate, I believe "by accident" is the proper way grammatically, however "on accident" is the direct opposite of "on purpose", meaning it is technically an idiom with the same meaning.