I thought I'd answered this before, but maybe it was on another thread. So here goes:
Please refer to this web site:
https://www.boondockersbible.com/knowledgebase/is-nude-camping-legal-on-federal-lands/
It's the best summary of the legal status of nudity on federally managed public land. It actually cites the regulations by number, which indicates that they've done some research into the question.
In short, nudity is considered a matter of regulation, not law. Therefore, while there is no law forbidding nudity on public land per se, there are plenty of regulations about it, mostly dealing with what the local authorities wish to consider "lewd or lascivious behavior."
As the previous poster pointed out, most rangers don't feel it necessary to prosecute nude people, although they are well within their rights to ask you to put clothes on if they decided to press the matter. So it just depends on which ranger you meet on which particular day at which particular site.
California's laws regarding their property are a bit murkier, it seems. It all hinges on the definition of "lewd or lascivious behavior." The way I read it, lewdness is in the eye of the beholder. So if somebody is beholding you and isn't aroused by the sight, you're fine. But if they are aroused, then you're guilty of a crime. It seems strange to be punished for somebody else's reaction to your nudity, but evidently that's what the law reads.