Vision transformer, a deep neural network has proven its effectiveness in detecting and classifying images. Vit needs optimization of the hyperparameters such as image size, patch size and mlp head (multi-layer perceptron). Although previous vit base studies have provided the effectiveness of vit. However, the parameter changes in the performance are narrowly reported. This study, therefore, takes lung cancer as a topic of study reports on 6 experiments. Lung cancer is one of the deadliest cancers all over the globe. However, this study reports on the top 3 results. The highest accuracy 99.87% was obtained using image 56 * 56 and patch size 7. The research is very significant as it expands our knowledge of the hyperparameters role in the performance of ViT. This study demonstrates the potential of Vision Transformers in terms of identification and categorization of lung cancer, assisting medical professionals in making more accurate diagnosis and treatment decisions.