

{"id":108575,"date":"2022-08-01T10:00:52","date_gmt":"2022-08-01T04:30:52","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=108575"},"modified":"2026-06-01T12:42:20","modified_gmt":"2026-06-01T07:12:20","slug":"python-internet-speed-test","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/python-internet-speed-test\/","title":{"rendered":"Internet Speed Test using Python"},"content":{"rendered":"<p>We all use the internet for multiple purposes ranging from learning to entertainment. And it is common for us to face the internet issue when we start relying on the applications to know the speed? Wouldn\u2019t it be helpful and also interesting to build an application yourself for checking internet speed? So, let\u2019s make python project to do internet speed test!<\/p>\n<h3>What is Internet Speed Test?<\/h3>\n<p>Internet Speed Tester is an application that measures internet quality or speed for the connected device. It is used by us when we face any internet issue or when we want to check the bandwidth of the internet.<\/p>\n<h3>Internet Speed Test in Python<\/h3>\n<p>We will be using the speedtest module to find out the internet speed. Here, we measure the following three speeds:<\/p>\n<p>1. Download Speed<\/p>\n<p>2. Upload Speed<\/p>\n<p>3. Ping<\/p>\n<p>And we use the Tkinter module to build the GUI for taking the choice of the user from the above three options and to display the respective speed.<\/p>\n<h3>Download Internet Speed Test Project<\/h3>\n<p>Please download the source code for the Internet speed test python project using the link: <a href=\"https:\/\/drive.google.com\/file\/d\/1ACzYy3UhyTFiAhkFZhvcoQ5lGfbmlY8J\/view?usp=drive_link\"><strong>Internet Speed Test Project<\/strong><\/a><\/p>\n<h3>Prerequisites<\/h3>\n<p>Prior knowledge of Python and the Tkinter module would help the developer while building the project. You can download the above mentioned modules using the following commands.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">pip install tk<\/pre>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">pip install speedtest-cli<\/pre>\n<h3>Steps to build Internet Speed Test Python Project<\/h3>\n<p>We will be doing the below simple steps to build the project:<\/p>\n<p>1. First, we import the required modules<\/p>\n<p>2. Then, write a function to calculate any of the three speeds<\/p>\n<p>3. Create a window and add three buttons for the three speeds<\/p>\n<p>4. Writing functions for the three buttons<\/p>\n<h3>1. Importing modules<\/h3>\n<p>We start by importing the tkinter and the speedtest modules. We use the messagebox to show the speed as a pop up message.<\/p>\n<p>And the option variable stores the one of the three speed options chosen.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">import tkinter \r\nfrom tkinter import *\r\nimport speedtest\r\nimport tkinter.messagebox\r\n\r\noption=''<\/pre>\n<h3>2. Function to find internet speed<\/h3>\n<p>In this function, we take the option variable and check the choice made by the user. And then, we use the Speedtest() method to calculate one of the three speeds.<\/p>\n<p>Then, based on the range of the speed, we convert the value and give the information in the form of a message with units in terms of \u2018bps\u2019, \u2018Kbps\u2019, \u2018Mbps\u2019, and \u2018Gbps\u2019.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">def showSpeed():\r\n    global option\r\n    st = speedtest.Speedtest()\r\n    if option == 'Download Speed':\r\n        speed=(st.download())\r\n\r\n    elif option == 'Upload Speed':\r\n\r\n        speed=(st.upload())\r\n\r\n    elif option == 'Ping':\r\n\r\n        servernames =[]\r\n\r\n        st.get_servers(servernames)\r\n\r\n        speed=(st.results.ping)\r\n    speedWithUnits=''\r\n    if(speed&lt;1000):\r\n        speedWithUnits=str(round(speed, 3))+\" bps\"\r\n    elif(speed&lt;1000000):\r\n        speedWithUnits=str(round(speed\/1000, 3))+\" Kbps\"\r\n    elif(speed&lt;1000000000):\r\n        speedWithUnits=str(round(speed\/1000000, 3))+\" Mbps\"\r\n    else:\r\n        speedWithUnits=str(round(speed\/1000000000, 3))+\" Gbps\"\r\n   \r\n    #print( \"Hi! Your\" +option+\" Speed is:\"+speedWithUnits)\r\n    tkinter.messagebox.showinfo(\"DataFlair Internet Speed Tester\",  \"Hi! Your \" +option+\" Speed is:\"+speedWithUnits)<\/pre>\n<h3>3. Creating the window<\/h3>\n<p>Here, we create a window, set title, size, color and then add labels along with three buttons to make a choice.<\/p>\n<p>For each button, we then write a function to modify the option variable.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#Creating the main window\r\nwn = tkinter.Tk()\r\nwn.title(\"DataFlair Internet Speed Tester\")\r\nwn.geometry('700x300')\r\nwn.config(bg='azure')\r\n \r\nLabel(wn, text='DataFlair Internet Speed Tester',bg='azure',\r\n      fg='black', font=('Courier', 15)).place(x=40, y=10)\r\n\r\nLabel(wn, text='Choose any of the below options',bg='azure',\r\n      fg='black', font=('Courier', 12)).place(x=20, y=40)\r\n\r\n#Button to convert Audio to PDF form\r\nButton(wn, text=\"Check Download Speed\", bg='ivory3',font=('Courier', 15),width=20,\r\n       command=downloadSpeed).place(x=230, y=80)\r\n\r\n#Button to Check Upload Speed\r\nButton(wn, text=\"Check Upload Speed\", bg='ivory3',font=('Courier', 15),width=20,\r\n       command=uploadSpeed).place(x=230, y=150)\r\n       \r\n#Button to convert Audio to PDF form\r\nButton(wn, text=\"Check Ping\", bg='ivory3',font=('Courier', 15),width=20,\r\n       command=ping).place(x=230, y=220)\r\n\r\n#Runs the window till it is closed\r\nwn.mainloop()\r\n<\/pre>\n<h3>4. Functions for the three buttons<\/h3>\n<p>These are the three functions we talked about in the previous step. Each function takes the global option variable. And then change its value and call the showSpeed() function.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">def downloadSpeed():\r\n    global option\r\n    option='Download Speed'\r\n    showSpeed()\r\n\r\ndef uploadSpeed():\r\n    global option\r\n    option='Upload Speed'\r\n    showSpeed()\r\n\r\ndef ping():\r\n    global option\r\n    option='Ping'\r\n    showSpeed()<\/pre>\n<h3>Output of Python Internet SpeedTest Project<\/h3>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/06\/python-internet-speed-test-output.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-111060\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/06\/python-internet-speed-test-output.webp\" alt=\"python internet speed test output\" width=\"962\" height=\"464\" \/><\/a><\/p>\n<h3>Summary<\/h3>\n<p>Congratulations! You have successfully completed building the Internet Speed Tester using Python. You got to build a GUI and also check speed using the speedtest module. Hope you enjoyed it and it helps in the future.<span hidden class=\"__iawmlf-post-loop-links\" data-iawmlf-links=\"[{&quot;id&quot;:2553,&quot;href&quot;:&quot;https:\\\/\\\/drive.google.com\\\/file\\\/d\\\/1ACzYy3UhyTFiAhkFZhvcoQ5lGfbmlY8J\\\/view?usp=drive_link&quot;,&quot;archived_href&quot;:&quot;http:\\\/\\\/web-wp.archive.org\\\/web\\\/20260601071211\\\/https:\\\/\\\/drive.google.com\\\/file\\\/d\\\/1ACzYy3UhyTFiAhkFZhvcoQ5lGfbmlY8J\\\/view?usp=drive_link&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-06-02 07:01:34&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-06 19:04:25&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-15 20:53:57&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-22 03:13:21&quot;,&quot;http_code&quot;:200}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-06-22 03:13:21&quot;,&quot;http_code&quot;:200},&quot;process&quot;:&quot;done&quot;}]\"><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>We all use the internet for multiple purposes ranging from learning to entertainment. And it is common for us to face the internet issue when we start relying on the applications to know the&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":111061,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[46],"tags":[26334,27124,26739,27123,26740,21082,22734,27125],"class_list":["post-108575","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","tag-basic-python-project","tag-check-internet-speed","tag-internet-speedtest-using-python","tag-python-internet-speed","tag-python-internet-speed-test-project","tag-python-project","tag-python-project-for-beginners","tag-python-speed-test"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Internet Speed Test using Python - DataFlair<\/title>\n<meta name=\"description\" content=\"Create project to do internet speed test using python in easy steps. It will measure three speeds: Download Speed, Upload Speed and Ping.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/python-internet-speed-test\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Internet Speed Test using Python - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Create project to do internet speed test using python in easy steps. It will measure three speeds: Download Speed, Upload Speed and Ping.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/python-internet-speed-test\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-08-01T04:30:52+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-06-01T07:12:20+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/06\/python-project-internet-speed-test.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Internet Speed Test using Python - DataFlair","description":"Create project to do internet speed test using python in easy steps. It will measure three speeds: Download Speed, Upload Speed and Ping.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/python-internet-speed-test\/","og_locale":"en_US","og_type":"article","og_title":"Internet Speed Test using Python - DataFlair","og_description":"Create project to do internet speed test using python in easy steps. It will measure three speeds: Download Speed, Upload Speed and Ping.","og_url":"https:\/\/data-flair.training\/blogs\/python-internet-speed-test\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2022-08-01T04:30:52+00:00","article_modified_time":"2026-06-01T07:12:20+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/06\/python-project-internet-speed-test.webp","type":"image\/webp"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/python-internet-speed-test\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/python-internet-speed-test\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/b49855299264df5e27e3ec6c2cd9fde9"},"headline":"Internet Speed Test using Python","datePublished":"2022-08-01T04:30:52+00:00","dateModified":"2026-06-01T07:12:20+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/python-internet-speed-test\/"},"wordCount":494,"commentCount":0,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/python-internet-speed-test\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/06\/python-project-internet-speed-test.webp","keywords":["basic python project","check internet speed","Internet SpeedTest using Python","python internet speed","Python internet speed test project","Python project","python project for beginners","python speed test"],"articleSection":["Python Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/python-internet-speed-test\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/python-internet-speed-test\/","url":"https:\/\/data-flair.training\/blogs\/python-internet-speed-test\/","name":"Internet Speed Test using Python - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/python-internet-speed-test\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/python-internet-speed-test\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/06\/python-project-internet-speed-test.webp","datePublished":"2022-08-01T04:30:52+00:00","dateModified":"2026-06-01T07:12:20+00:00","description":"Create project to do internet speed test using python in easy steps. It will measure three speeds: Download Speed, Upload Speed and Ping.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/python-internet-speed-test\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/python-internet-speed-test\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/python-internet-speed-test\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/06\/python-project-internet-speed-test.webp","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/06\/python-project-internet-speed-test.webp","width":1200,"height":628},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/python-internet-speed-test\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Python Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/python\/"},{"@type":"ListItem","position":3,"name":"Internet Speed Test using Python"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/b49855299264df5e27e3ec6c2cd9fde9","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/ef46b745ddad2fad690af626c6ef29b91809ad0a9f5ef398d07817d8cad042f5?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/ef46b745ddad2fad690af626c6ef29b91809ad0a9f5ef398d07817d8cad042f5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ef46b745ddad2fad690af626c6ef29b91809ad0a9f5ef398d07817d8cad042f5?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team is a group of passionate educators and industry experts dedicated to providing high-quality online learning resources on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. With years of experience in the field, the team aims to simplify complex topics and help learners advance their careers. At DataFlair, we believe in empowering students and professionals with the knowledge and skills needed to thrive in today\u2019s fast-paced tech industry. Follow us for Free courses, expert insights, tutorials, and practical tips to boost your learning journey.","url":"https:\/\/data-flair.training\/blogs\/author\/datafbdad\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/108575","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=108575"}],"version-history":[{"count":5,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/108575\/revisions"}],"predecessor-version":[{"id":148630,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/108575\/revisions\/148630"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/111061"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=108575"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=108575"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=108575"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}