Using HTTP/3 with curl enables testing modern, QUIC-based connections directly from the command line. Leveraging the latest protocol generation helps evaluate performance, latency behaviour, and resilience on paths where traditional HTTP/1.1 and HTTP/2 may suffer from head-of-line blocking or packet loss. Quick one-off requests make it easy to compare behaviour between protocol versions without changing browser settings or application code.
The curl client negotiates protocol versions with servers using ALPN and optional Alt-Svc hints, and can switch to HTTP/3 when both endpoints support QUIC. When built with libraries such as ngtcp2 and nghttp3, curl exposes --http3 and --http3-only flags to request the new transport while retaining the familiar syntax for headers, bodies, and authentication. Version output and transfer metadata reveal which protocol was used for each request, even when the connection silently falls back to HTTP/2 or HTTP/1.1.
Not every packaged build of curl includes QUIC support, and many servers still prefer earlier protocol versions or announce HTTP/3 only via DNS or Alt-Svc records. Firewalls and middleboxes can also block or rate-limit UDP traffic, which interrupts QUIC flows even when TCP-based HTTP remains functional. Forcing HTTP/3 exclusively can therefore produce errors on otherwise healthy endpoints, so output must be interpreted with awareness of these deployment constraints.
Steps to use HTTP/3 with cURL:
- Open a terminal where curl is installed.
$ whoami user
Any shell with network access is sufficient as long as the curl binary resides in the PATH.
- Check the compiled features in curl and confirm that HTTP/3 support is present.
$ curl -V curl 8.5.0 (x86_64-pc-linux-gnu) libcurl/8.5.0 OpenSSL/3.0.2 zlib/1.2.11 nghttp2/1.57.0 ngtcp2/1.4.0 nghttp3/1.1.0 Release-Date: 2023-12-06 Protocols: dict file ftp ftps http https Features: AsynchDNS HTTP3 IPv6 Largefile libz NTLM SSL TLS-SRP UnixSockets ##### snipped #####
The presence of HTTP3 in the Features line indicates that the installed curl can negotiate HTTP/3 when a server and path permit QUIC.
- Prefer HTTP/3 for a normal request while still allowing fallback to earlier protocol versions.
$ curl --http3 https://example.com/ <!doctype html> <html> <head> <title>Example Domain</title> ##### snipped #####With --http3, curl attempts QUIC first but silently continues with HTTP/2 or HTTP/1.1 if the remote endpoint or network does not support HTTP/3.
- Force HTTP/3 only against a known QUIC-enabled endpoint and print just the negotiated protocol version.
$ curl --http3-only --silent --output /dev/null --write-out "%{http_version}\n" https://cloudflare-quic.com/ 3When --http3-only is used against a server or path that cannot complete a QUIC handshake, the transfer fails instead of falling back, which can resemble a generic connectivity issue even though earlier HTTP versions still work.
- Inspect verbose logs while forcing HTTP/3 to verify that QUIC is used on the wire.
$ curl --http3-only --verbose https://cloudflare-quic.com/ --output /dev/null * Trying 104.16.133.229:443... * Connected to cloudflare-quic.com (104.16.133.229) port 443 (#0) * Using HTTP/3 * h3 [:method: GET] * h3 [:scheme: https] * h3 [:authority: cloudflare-quic.com] * h3 [:path: /] ##### snipped #####
Successful HTTP/3 usage is confirmed by the Features: HTTP3 flag in curl -V output, a value of 3 from %{http_version}, and verbose logs containing lines such as Using HTTP/3 with h3 pseudo-headers.
Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.
Comment anonymously. Login not required.
