React project run on localhost:3000.
Then you start a Vite project, and suddenly it's localhost:5173. π€
Why such a random number? I finally looked it up, and it's not random at all.
π’ First, what is a port?
Think of your computer as an apartment building.
| In real life | On your computer |
|---|---|
| The building |
localhost (your own machine) |
| A flat number | The port |
| The person living there | Your running app |
So localhost:5173 simply means:
"Go to my building and knock on flat 5173."
π΅οΈ The secret hidden in 5173
Squint a little and read it like this:
| Number | Letter | Why |
|---|---|---|
| 5 | V | Roman numeral for 5 |
| 1 | I | Looks like I |
| 7 | T | Looks like T |
| 3 | E | A flipped E |
5173 = VITE β‘
It's like a personalised number plate. At first you see digits, then you spot the name, and you can't unsee it.
π Vite used to live at 3000
Here's the part I didn't know: earlier versions of Vite used port 3000 too.
In Vite 3, the team changed the default to 5173 to move away from such a commonly used port.
Imagine flat 3000 is the most popular flat in the building. Many tools want to move in, but for a given address, only one can live there at a time. So Vite packed its bags and moved to a flat with its own name on it. π¦
Why was 3000 picked in the first place? I couldn't find a confirmed reason.
It's like a popular hangout spot. People keep going there because everyone already knows it.
π΅ Why am I seeing 5174?
Sometimes your project opens on 5174 instead.
That means flat 5173 is already occupied, often by another Vite project you left running in a different terminal.
By default, Vite knocks on the next door:
5173 β occupied
5174 β
free, moving in!
If 5174 is busy too, it keeps looking.
π οΈ Want to choose the port yourself?
In vite.config.js:
import { defineConfig } from 'vite'
export default defineConfig({
// keep your existing plugins here
server: {
port: 3000,
strictPort: true,
},
})
-
port: the flat you want -
strictPort: true: "This flat or nothing!" Vite stops with an error instead of trying the next one
Or do it just once from the terminal:
npm run dev -- --port 3000
π― Quick recap
- π’ A port is like a flat number
- β‘
5173can be read as VITE - π¦ Vite 3 moved the default from
3000to5173 - πͺ
5174usually appears because5173is busy
Happy Coding :)


Top comments (2)
I never noticed that 5173 actually spells VITE π That's so clever. Learned something new today π
yes, glad you liked it π