And while getting some shut-eye inside your car isn't necessarily illegal, it's where you are parked while you sleep that can get you in trouble. For instance, many parking lots, private garages, and even public areas ban overnight parking — with or without sleeping people onboard.
People Also Ask
There's no specific federal law that expressly forbids sleeping in your car. However, there are federal laws that indirectly limit the instances in which sleeping in your car is legal: Private Property Laws: Trespassing on private property is a quick way to make sleeping in your car illegal.
You can park anywhere as long as it's not forbidden. Car camping is allowed in most European countries, except Slovenia that fines heavily sleeping in the car outside of the designated (and very expensive) spots.
The police can, in most cases, do a welfare check on someone asleep in their car. They want to make sure you're not injured, hurt, need assistance, and that how they get to knock on your car. They also want to make sure that you haven't been drinking and driving.
It is not dangerous insofar as carbon monoxide poisoning is concerned if your ENGINE IS OFF and you sleep in your car with the windows closed. Unless you have a very old and leaky engine/high emissions car, in which case the window seals are probably shot, too.
The Spanish road traffic law (Instrucción 08 / V-74) says in broad terms: you can park (and spend the night) in your car (camper) but you are not allowed to camp on public roads.