“On-site” is an adjective. It comes before the noun it describes.
“On site” is a prepostitional phrase. It comes after the noun it describes.
“Onsite” is not a thing, but it looks like the name for a pretty rock.
It’s preferable to use the two-word version, to avoid confusion regarding hyphen use.
Example
Avoid: Onsite parking
Try: On-site parking
Try: Parking on site