Contractor licensing is one of the least standardized things in the trades. Every state has its own rules, some delegate to cities, and a few don't license at all. This is the high-level map of what to look up for your state.
California (CSLB), Florida (DBPR), Arizona (ROC), Nevada, Hawaii, Virginia, North Carolina, South Carolina, and Tennessee all run state-level licensing systems with mandatory exams, experience requirements, bonds, and insurance. These are the strictest states; getting licensed often takes 2-6 months.
New York (mostly city/county), Pennsylvania (no state license), Texas (no general license — specific trades only), Massachusetts (specific trades), Illinois (no general license). In these states, the requirement usually comes from the city or county where you work.
If you cross state lines for a job, you typically need to be licensed in the state where the work is performed. Some states have reciprocity agreements (look up 'contractor license reciprocity'); most don't.
Typically 2-6 months in stricter states (CA, FL, AZ) — application processing, exam scheduling, bond setup, and background checks all stack up. Plan ahead.
In most regulated states, no — working without a required license can void your contracts and your insurance, and expose you to fines or criminal charges in some states.