Vite Development Server Port
β‘ Open localhost:5173Vite's default dev server, with HMR over native ES modules
localhost:5173 is the address Vite’s dev server binds to by default when you run npm run dev. localhost resolves to 127.0.0.1 (your machine), and 5173 is the port Vite picked back in v2.7 to dodge collisions with Create React App on 3000 and friends.
There’s a small joke in the number itself: 5-1-7-3 reads as V-I-T-E if you squint at a phone keypad. Cute, but the reason most frontend projects you touch in 2026 land on this port is more boring - Vite is the default dev server for almost every modern framework.
As of 2026, Vite 8 ships with Rolldown, a Rust-based bundler that replaces the old Rollup + esbuild split. Production builds are 1.6x to 7.7x faster than Vite 7 on real codebases (Linear reported 46s -> 6s; Ramp -57%; Beehiiv -64%). Plugin API compatibility was preserved, but some Rollup plugins that reach into internals still need updates - check before upgrading large monorepos. The dev server on localhost:5173 works the same as before, though under the hood it now uses the Environment API (introduced in Vite 6) to handle client, SSR, and edge runtimes as separate, configurable environments - the foundation TanStack Start, Nuxt, and SvelteKit build on for unified dev/prod parity. Around it, the ecosystem has picked up TanStack Start (full-stack React on Vite, v1 RC since early 2026), Vite+ (VoidZero’s integrated toolchain), and coding agents like Claude Code and Cursor that drive the Vite server for browser automation.
localhost only resolves on the machine running Vite, so a phone on the same Wi-Fi or a teammate on the other side of the office can’t hit it directly. Two options: bind Vite to your LAN IP (npm run dev -- --host then visit http://<your-ip>:5173), or open a tunnel for anyone on the internet. For the second case, a one-line
Pinggy command works without installing anything:
You’ll get back a public HTTPS URL that proxies to localhost:5173. Useful for sharing a WIP build with a client, testing on iOS Safari without messing with certs, or pointing a webhook (Stripe, Clerk, GitHub) at a local handler. Heads-up: Vite’s HMR runs over WebSockets, and depending on your vite.config.js you may need to set server.hmr.clientPort: 443 and add the tunnel host to server.allowedHosts for hot reload to keep working over the tunnel.
Port 5173 is primarily used by Vite and Vite-powered applications across the modern frontend ecosystem. Here are the main applications:
npm create vue@latest) wires up Vitevite.config.jsserver.open: false + strictPort: true so the URL is predictable for headless browser stepsfetch during dev so you can build against an API that doesn't exist yetdevOptions.enabled: true@vitejs/plugin-react-oxc for faster transforms@hono/vite-dev-server) for full-stack apps on a single portvite-plugin-svelte to @vitejs/plugin-react-oxcRun npm run dev, yarn dev, or pnpm dev and Vite starts on 5173 with no config. You get cold-start in tens of milliseconds (vs ~10s for CRA on a comparable app), HMR over a WebSocket on the same port, native ESM in the browser, dependency pre-bundling via esbuild on first run, and zero-config TypeScript transpilation (note: not type-checking - run tsc --noEmit separately or via Vitest).
When the dev server isn’t reachable on 5173, it’s almost always one of four things:
The Fix: Fire up your dev server if it's not already going.
What to do:
npm run dev, yarn dev, or pnpm devThe Fix: Port 5173 is already taken by something else.
Quick wins:
lsof -i :5173 (Linux/macOS) or netstat -ano | findstr :5173 (Windows)kill -9 <PID>npm run dev -- --port 5174The Fix: Something's wrong with your setup.
Try these:
npm install or yarn installnode_modules/.vite directoryThe Fix: Test if your server is actually reachable.
Check it:
http://localhost:5173curl http://localhost:5173npm run dev -- --host for external accessA few things about how Vite handles 5173 that trip people up:
server.strictPort: true in vite.config.js (or --strictPort on the CLI) and Vite will exit instead.vite dev and vite preview are different ports. Dev runs on 5173. vite preview (which serves your production dist/ for smoke-testing) defaults to 4173. They’re different processes serving different bundles - don’t share state between them.--host exposes you on the LAN. Without it, Vite binds to 127.0.0.1 and is reachable only from your machine. With --host (or server.host: true), it binds to 0.0.0.0 - now anyone on the same Wi-Fi can hit your dev server. Fine at home, less fine on a hotel or coffee-shop network.allowedHosts is enforced. Since Vite 6, requests with a Host header outside server.allowedHosts are rejected with a 403. This matters when proxying through a tunnel or a reverse proxy - add the public hostname or set it to true for dev.localhost isn’t your host. Inside a container, localhost is the container itself. Run Vite with --host 0.0.0.0, expose 5173 in your Dockerfile/compose, and visit http://localhost:5173 from the host - it’ll forward in. For HMR, you may also need server.hmr.host set to the host name the browser uses.server.https, but generating a trusted cert is the painful part. vite-plugin-mkcert automates this (uses mkcert under the hood) and is the standard answer when you need HTTPS for OAuth callbacks, PWAs, or anything that requires a secure context.Here are typical issues with localhost:5173 and how to resolve them:
You'll see: "Port 5173 is in use..."
Quick fix: lsof -i :5173 to find who's using it, kill -9 <PID> to kill it, or just switch ports with npm run dev -- --port 5174
You'll see: Errors during startup or fails immediately
Quick fix: npm install to reinstall deps, check vite.config.js for typos, or nuke node_modules/.vite cache
You'll see: Save a file but browser doesn't update
Quick fix: Check browser console for WebSocket errors, make sure your IDE is watching files, or just restart Vite
You'll see: Works on localhost but not from phone or other PC
Quick fix: npm run dev -- --host then access via your machine's IP like http://192.168.1.100:5173
You'll see: Takes forever to start or first page load is sluggish
Quick fix: rm -rf node_modules package-lock.json && npm install, remove the node_modules/.vite folder, or optimize dependencies in vite.config.js
You'll see: Vite starts but complains about a plugin
Quick fix: Check plugin versions match your Vite version, verify the config is correct, and update plugins with npm update
You'll see: Page loads fine, but the console shows WebSocket connection to 'wss://...:5173' failed and edits don't hot-reload
Quick fix: Vite's client tries to open the WebSocket on port 5173, but tunnels/proxies only expose 443. Set server.hmr.clientPort: 443 (and server.hmr.protocol: 'wss' if needed) in vite.config.js, and add the public host to server.allowedHosts.
You'll see: Importing a sibling package in a pnpm/npm workspace 403s with that error
Quick fix: Add the workspace root (or the specific package paths) to server.fs.allow in your vite.config.js. Default is the project root only; in a monorepo, Vite refuses to serve files above it for security.
localhost:5173 is Vite’s default dev server address (127.0.0.1 on TCP 5173).lsof -i :5173 to see what’s bound, then npm run dev and watch the terminal for the “Local: http://localhost:5173/” line.--port 5174, wipe node_modules/.vite, or use --host to expose it on your LAN.# Vue
npm create vue@latest my-app && cd my-app && npm install
# React (Vite template)
npm create vite@latest my-app -- --template react-ts
# TanStack Start (full-stack React on Vite)
npm create @tanstack/start@latest my-app
# Same scaffold with Bun (faster install)
bunx create-vite@latest my-app --template svelte-ts
# Start dev server (binds to localhost:5173)
npm run devUse these commands to quickly get started with Vite on localhost:5173
If you’ve worked with frontend tooling in the last few years, 5173 is probably one of the more memorable numbers in your shell history. It’s not magic - it’s just the port Vite picked, and Vite happens to be what most frameworks now ship as their dev server. Knowing how to find what’s bound to it, how to move off it, and how to expose it safely covers 90% of what you’ll ever need.