Synchronous vs Asynchronous Programming — What's the Difference?

Synchronous code executes one operation at a time, blocking until each finishes before moving to the next; asynchronous code can start a long-running operation and continue with other work while it completes in the background.

Published October 4, 2026

Synchronous code runs one step at a time, waiting for each to finish; asynchronous code starts a slow task (network, disk, timer) and carries on, handling the result later. Async keeps programs responsive during waiting.

The concept

In synchronous code a slow call blocks everything after it. In asynchronous code the call returns immediately and a callback, promise or await resumes the work when the result is ready.

Async is not the same as parallel: JavaScript is single-threaded and uses an event loop to interleave waiting tasks.

Timeline

sync: [request A ........][request B ........] 16s
async: [request A ........]
[request B ........] 8s

Practical examples

Synchronous

import time
time.sleep(2)   # blocks
print('done')

Asynchronous

console.log('start')
setTimeout(() => console.log('later'), 1000)
console.log('end')   // start, end, later

async/await

const [a, b] = await Promise.all([fetchA(), fetchB()])

Common mistakes

  • Doing CPU-heavy work in an async function and still blocking the loop.
  • Awaiting independent calls one after another.
  • Forgetting error handling on promises.

Key takeaways

  • Sync waits, async continues.
  • Async suits I/O.
  • Run independent tasks concurrently.

FAQ

Async vs multithreading?

Async interleaves tasks on one thread; threads run truly in parallel on several cores.

When should I stay synchronous?

For simple scripts or when each step depends on the previous.

More General articles