Instead of Axios: Ky
Use Ky for new code, or plain fetch for simple cases. Fetch is now built into browsers and Node.js, and Ky is a small wrapper over it with no dependencies that adds what people pick axios for, such as JSON shortcuts, errors on non-2xx responses, timeouts, retries and hooks.
Both are for making HTTP requests from JavaScript in the browser and Node.js.
Why Ky is better
- Ky has no dependencies and uses the platform's fetch. Axios installs four packages (follow-redirects, form-data, https-proxy-agent and proxy-from-env) and ships its own XHR and Node http adapters.
- Retries come built in. By default Ky retries idempotent requests on network errors and on status codes 408, 429, 500, 502, 503 and 504, and honors Retry-After headers.
- It returns standard Request and Response objects, so what you learn carries over to plain fetch, and it runs unchanged in browsers, Node.js, Bun and Deno.
- TypeScript defaults are safer, since .json() returns unknown rather than any, and it can validate a response with a Standard Schema validator such as Zod.
- Hooks such as beforeRequest, afterResponse and beforeRetry cover what axios interceptors are used for.
When to keep Axios
Keep axios in a large codebase built around its interceptors and request config, or when you need its Node http adapter features such as proxy settings from environment variables. It is actively maintained and has had a fetch adapter since version 1.7.0, so there is no urgency to remove it from working code.
Switching
Call sites change shape. axios.get(url) followed by response.data becomes await ky.get(url).json(), axios.post(url, body) becomes ky.post(url, { json: body }), axios.create becomes ky.create with a baseUrl option, and interceptors become hooks. Error handling moves from AxiosError to Ky's HTTPError, which carries the Response.
Watch out
Ky only runs where fetch exists, so it has no fallback for very old browsers. Its README already documents the next major version, so expect some breaking changes when it ships. Ky is maintained mainly by Sindre Sorhus.
Also worth a look
- Fetch API Built into browsers and, as a stable API since Node.js 21, into Node; use it directly when you make a few simple requests and do not need retries or errors on failed status codes.
More newer, better libraries, runtimes and developer tools
Sources
- Ky README
- Axios: First steps
- Axios README
- Axios package.json
- Fetch API, MDN
- Node.js: Global objects (fetch)
Judged on 2026-11-06. See every libraries, runtimes and developer tools, or all 66 replacements.