Some barrel nuts have imperial and some have metric threads. You occasionally read of people having to rethread the receiver to fit an incompatible nut. Hopefully with a search you can find out what you have, and hopefully whoever is selling what you want provides the correct information. There's a lot of hopefully's with fitting parts in airsoft.
Edit to add I'm assuming it's airsoft M4 spec.
https://miairsoft.proboards.com/thread/23328/m4-barrel-nut-specs