How do you know if you have a broken bone?

X-ray. The best way would be to have an x-ray but pain and deformity would be a good indicator.
Pain swelling. A broken bone will be painful and the area of the break will swell. If it is in the legs then you will have difficulty walking. If it is in the upper extremities then you would have difficulty using the affected extremity.