The embodiment of the invention provides a visual classification method and device for Internet of Things malicious software and an electronic device, and the method comprises the steps: carrying outthe binary file extraction of to-be-classified Internet of Things malicious software, obtaining a binary malicious code, and carrying out the bit combination of the binary malicious code to generate agray-scale image; and performing feature extraction on the grayscale image, and based on the extracted grayscale image features, utilizing a deep neural network classification model based on a 2-bitnetwork to obtain a classification category to which the to-be-classified Internet of Things malicious software belongs. According to the embodiment of the invention, a classification model based on a2-bit network is adopted, model size and calculation time can be substantially reduced, the processed malicious software is converted into the gray level image, feature extraction is carried out according to the gray level image, visual features of extracted features can be improved, the classification process is made to have higher interpretability, and classification of the Internet of Things malicious software can be more reliably and efficiently accomplished.