The legality of ultrasonic dog barking devices varies by location. In some areas, there may be restrictions or regulations regarding the use of such devices due to concerns about potential harm or discomfort to dogs. It's important to research and understand local laws before using an ultrasonic dog barking device.