You can press ctrl-c which sends SIGINT signal that immediately interrupts your program and stops it ( Unless you have a custom handler for this signal ;) )

Answer from Masrur Rahman on Stack Overflow
🌐
Reddit
reddit.com › r/learnpython › how do i stop an infinite loop in vs code?
r/learnpython on Reddit: How do I stop an infinite loop in vs code?
June 1, 2023 -

Hello! Just started learning python and got introduced to what infinite loops are! I typed up some stuff to make an infinite loop and tried to do ctrl+C to kill it in the vs code terminal but it wouldn't work. I tried cmd+C too (I have a Mac) and that code kept going... Would love help and direction in what I'm doing wrong + how to stop an infinite loop!

Edit: Thank you all for your helpful tips! :)

🌐
BytePlus
byteplus.com › en › topic › 504295
How to stop infinite loop in vs code
Build better products, deliver richer experiences, and accelerate growth through our wide range of intelligent solutions. Core content of this page: How to stop infinite loop in vs code
🌐
Reddit
reddit.com › r/vscode › keyboard shortcut to terminate infinite loop in python
r/vscode on Reddit: Keyboard shortcut to terminate infinite loop in Python
November 24, 2019 -

As the title says, I'm an absolute noob at VSC, I'm using it for Python. Previously, I used to use Notepad++, but it's been bugging me.

Basically , I have a bad habit of creating infinite loops and generally I've been able to set up keyboard shortcuts to terminate the code. Having trouble finding an answer. I've seen places say to use Ctrl + C and Ctrl + Alt + M, but neither work.

Edit: I have a Windows, not Mac.

🌐
YouTube
youtube.com › watch
How to stop an infinite loop in Python - YouTube
This video is meant to be a quick guide to programmers who have ran into an infinite loop. I hope this helps someone!!
Published: January 10, 2024
🌐
YouTube
youtube.com › watch
How to Exit and Infinite Loop in VS Code - YouTube
Subscribe to Simplech -- http://bit.ly/SimplechYTEmail: simplechofficial@gmail.com--Music provided by Chillhop MusicLoyae - Green Caphttps://chll.to/0f3fdfdf
Published: July 8, 2025
🌐
YouTube
youtube.com › shorts › tBnAk69v72c
How to Stop an Infinite Loop in VS Code | VS Tips & Tricks | Part 2 - YouTube
Do you ever get stuck in an infinite loop in Visual Studio Code? Here's an easy fix! In this video, we'll show you how to fix an infinite loop in VS Code qui...
Published: December 6, 2023
Views: 23K
🌐
AlgoCademy
algocademy.com › blog › techniques-for-breaking-infinite-loops-during-live-coding
Techniques for Breaking Infinite Loops During Live Coding – AlgoCademy Blog
In Python, you can use the KeyboardInterrupt exception to break out of infinite loops: try: while True: # Your loop logic here pass except KeyboardInterrupt: print("Loop interrupted by user") For browser-based JavaScript, you can use the window.stop() method to stop the execution of an infinite ...
Find elsewhere
🌐
GitHub
github.com › microsoft › vscode-jupyter › issues › 9874
Ctrl+C doesn't break out of an infinite loop while a cell is running. · Issue #9874 · microsoft/vscode-jupyter
May 3, 2022 - Run an infinite loop in one of the notebook's cell, and try Ctrl+C. The cell will continue running and timeout after awhile. ... Sign up for free to join this conversation on GitHub.
Author: microsoft
🌐
GitHub
github.com › microsoft › vscode › issues › 103796
python Infinite loops can't be killed · Issue #103796 · microsoft/vscode
August 2, 2020 - Infinite loop re-occurs. i = 0 while i < = 5: print("hi there world") # i += 1 .....Run first time with this statement commented. Kill program. Un-comment and rerun. VS Code version: Code 1.47.3 (91899dc, 2020-07-23T13:12:49.994Z) OS version: Windows_NT x64 10.0.19041
Author: microsoft
🌐
Developer Community
developercommunity.visualstudio.com › t › Cannot-break-in-infinite-loops › 10656420
Cannot break in infinite loops - Developer Community
Visual Studio IDE Visual Studio Code Azure DevOps Team Foundation Server Accounts and Subscriptions Subscriber Access
🌐
DEV Community
dev.to › crhodes2 › how-to-fix-an-endless-loop-in-python-c3p
How to fix an Endless Loop in Python? - DEV Community
October 17, 2017 - Learning python the hard way by Zed Shaw. Wonder if I'll ever get a job or be good enough for one. Yeah of course I am :) ... the other one I like using is, While not True, than in side your if statement make it True once you've done what you want. ... On the topic of endless loops, try out Florian Rohrer's Endless Loop Challenge. It was a fun exercise. ... Just checked it out, and posted my own code there.
🌐
GitHub
github.com › microsoft › vscode › issues › 108021
Killing the terminal in while in an infinite loop crashes vscode. · Issue #108021 · microsoft/vscode
October 3, 2020 - Whenever I have a infinte loop (python3) and I run it. There is no way to stop it. Killing the terminal crashes VScode. I tried in Ubuntu but no issue. Only the windows version has this problem (AFAIK). VSCode Version: 1.49.3 OS Version:...
Author: microsoft
🌐
GitHub
github.com › microsoft › vscode › issues › 80819
Infinite loop in terminal · Issue #80819 · microsoft/vscode
September 12, 2019 - VSCode Version: 1.38 OS Version: Windows_NT x64 10.0.18362 Steps to Reproduce: Whenever I run any python file from VS Code without debugging (it is fine debugging) in a particular private github re...
Author: microsoft
🌐
Facebook
facebook.com › groups › cs50 › posts › 1717522535061451
Hi guys, quick question. If I accidentally create an infinite ...
Popular groups · Find communities for you · Over 1 billion people across the globe are using Facebook Groups to explore their favorite topics · Log in · Categories · Science & tech · Travel · Animals · Sports & fitness · Entertainment
🌐
YouTube
youtube.com › watch
Avoiding Infinite Loops - YouTube
Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.
Published: September 15, 2020
🌐
Developer Community
developercommunity.visualstudio.com › content › problem › 256765 › visual-studio-becomes-stuck-in-an-infinite-loop-an.html
Visual Studio becomes stuck in an infinite loop and hangs ...
Skip to main content · Microsoft · Visual Studio · Sign in · You need to enable JavaScript to run this app · Sorry this browser is no longer supported · Please use any other modern browser like 'Microsoft Edge'