What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
If Node.js reports a peer as ::ffff:127.0.0.1, it is showing an IPv4 address in IPv4-mapped IPv6 form. To convert the common dotted-quad form, verify the exact ::ffff: prefix, validate all four IPv4 octets, and then use the embedded IPv4 value. Do not strip a prefix from arbitrary input or assume every IPv4 connection will use this representation.
What an IPv4-mapped IPv6 address means
An IPv4-mapped IPv6 address is an IPv6-format address used to represent an IPv4 node. Its 96-bit prefix is ::ffff:0:0/96: 80 zero bits followed by 16 bits set to one, with the final 32 bits holding the IPv4 address. RFC 4291, section 2.5.5.2, defines this address type for representing IPv4 nodes as IPv6 addresses (RFC 4291).
For example, the IPv4 address 192.0.2.10 can appear as ::ffff:192.0.2.10. The same last 32 bits can also be written in hexadecimal, as ::ffff:c000:20a. These are two textual forms for the same mapped value; a dotted IPv4 tail is convenient to read, but it is not the only possible spelling.
Why Node.js may show ::ffff:
Node.js networking APIs expose peer and address information as IPv4 or IPv6 strings. Depending on the operating system, listener configuration, DNS options, and proxy topology, an IPv4 peer can therefore appear in mapped form rather than as a plain dotted IPv4 address. The Net API describes network addresses and the address information exposed by networking classes (Node.js Net documentation).
Recommended Free Tools
#1 Best Overall
This is a representation, not evidence of a different IPv4 host. It is also not guaranteed that every IPv4 client will appear this way. Check the actual value at the relevant socket or server boundary instead of assuming a single format.
Normalize a mapped address in Node.js
Small helper for dotted-quad input
If your input is a known Node socket address or another controlled source and you only need to handle the common dotted form, a small helper can validate the prefix and the embedded IPv4 octets:
function normalizeMappedIPv4(address) {
if (typeof address !== 'string') return null;
const match = address.match(/^::ffff:(d{1,3}(?:.d{1,3}){3})$/i);
if (!match) return address;
const octets = match[1].split('.').map(Number);
if (octets.some((n) => n < 0 || n > 255)) return null;
return match[1];
}
console.log(normalizeMappedIPv4('::ffff:192.0.2.10'));
// 192.0.2.10
console.log(normalizeMappedIPv4('2001:db8::1'));
// 2001:db8::1
console.log(normalizeMappedIPv4('::ffff:192.0.2.999'));
// null
The helper returns the original string when it does not match the dotted mapped form, converts a valid dotted mapped address to IPv4 text, and returns null when the mapped prefix is present but its embedded octets are out of range. That distinction is useful: malformed mapped-looking input should not silently pass as a valid normalized client address.
What this helper does not parse
This deliberately small example does not accept every legal spelling or establish that arbitrary input is a valid IP address. In particular, it will not convert the hexadecimal-tail form ::ffff:c000:020a. It also does not define a policy for bracketed URL hosts, IPv6 zone identifiers, whitespace, or other noncanonical forms. Decide whether to reject, parse, or preserve those forms at the boundary where they enter your application.
Rank #2
Do not treat any IPv6 string containing hexadecimal digits as mapped. A mapping decision requires the RFC-defined mapped prefix and valid embedded IPv4 data. If the input space includes multiple textual forms or more demanding validation rules, use a parser that understands IPv6 rather than extending a prefix-removal expression by guesswork.
Use a parser for broader input coverage
The ip-address package documents isMapped4() and embeddedIPv4() for identifying mapped addresses and retrieving their embedded IPv4 value (ip-address package documentation). A parser is a better fit when inputs can use hexadecimal tails or other valid IPv6 notations, or when validation requirements go beyond the narrow dotted-quad helper.
Choose and test a specific parser version in your application, and check its documented behavior for the exact forms you accept. Regardless of implementation, decide explicitly what to do with invalid input and whether to preserve the original text alongside a normalized value.
Read the address from a Node socket
For a TCP server, the peer address is available from the accepted socket’s remoteAddress. The following example logs both the original and normalized forms; it does not trust forwarded headers or change the socket itself:
Rank #3
const net = require('node:net');
function normalizeMappedIPv4(address) {
if (typeof address !== 'string') return null;
const match = address.match(/^::ffff:(d{1,3}(?:.d{1,3}){3})$/i);
if (!match) return address;
const octets = match[1].split('.').map(Number);
if (octets.some((n) => n < 0 || n > 255)) return null;
return match[1];
}
const server = net.createServer((socket) => {
const originalAddress = socket.remoteAddress;
const canonicalAddress = normalizeMappedIPv4(originalAddress);
console.log({ originalAddress, canonicalAddress });
socket.end('Address recordedn');
});
server.listen(3000, '::', () => {
console.log('Listening on port 3000');
});
This is a runnable TCP-server example for a Node.js version that supports the node: built-in module specifier. The address actually reported remains dependent on the host networking setup. If you only need the conversion function, use it with the address your application already receives rather than changing listener configuration just to force a particular display.
Handle DNS mapped results correctly
Mapped addresses can also arise from DNS lookup options. Node’s DNS documentation says dns.V4MAPPED returns IPv4-mapped IPv6 addresses when IPv6 was requested but no IPv6 addresses were found. With dns.V4MAPPED, dns.ALL can return native IPv6 and mapped IPv4 results together (Node.js DNS documentation).
This behavior is intentional: code requesting IPv6 results can still receive an IPv4 destination represented in IPv6 form. If your application consumes lookup results, account for both native IPv6 and mapped IPv4 rather than assuming every returned string is a native IPv6 endpoint. Do not convert all results indiscriminately; normalize only values you have identified and validated as mapped IPv4.
Choose a canonicalization policy
IPv4 and IPv4-mapped IPv6 text can identify the same underlying IPv4 value, so inconsistent representations can lead to duplicate records or inconsistent policy decisions. A practical design is to preserve the source value where audit fidelity matters and derive a canonical value for operations that need consistent identity.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchRank #4
| Approach | Input coverage | Validation | Useful when |
|---|---|---|---|
| Small dotted-quad helper | Common ::ffff:a.b.c.d form |
Exact prefix and octet range checks; not a general IPv6 parser | Input is controlled and the accepted format is deliberately narrow |
IPv6 parser such as ip-address |
Broader valid IPv6 textual forms, subject to the library’s documented support | Parser-based; verify behavior and version for your application | Inputs may include hexadecimal tails or require more complete parsing |
| Preserve original and derive canonical form | Depends on the chosen parser or helper | Retains source text while allowing validated normalization | Logs and audit records need the received representation, while keys or policies need consistency |
For authorization checks, rate limiting, deduplication, and logs, choose one documented representation and apply it consistently. A defensible pattern is to retain the original value and use a validated canonical value for comparisons. This is an engineering safeguard against duplicate textual representations; it does not make an untrusted address trustworthy.
Do not confuse socket addresses with forwarded headers
A socket’s remoteAddress describes the peer connected to that socket. Behind a reverse proxy, that peer may be the proxy rather than the end user. Headers such as X-Forwarded-For are separate inputs and must only be interpreted under an explicitly configured proxy-trust policy. A string beginning with ::ffff: is not proof that it came directly from a client, especially when the value came from a request header.
Keep these steps separate: establish which component supplied the value, apply the appropriate trust rules, validate its address syntax, and only then normalize it for your application. Do not use a normalization helper as a substitute for proxy configuration.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Troubleshoot common cases
The address stays in IPv6 form
The helper preserves any string that does not match the dotted mapped pattern. It will therefore leave native IPv6 addresses and hexadecimal mapped tails unchanged. If broader textual forms are expected, use a parser and test those forms rather than stripping characters based on appearance.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →The helper returns null
In the example, null means the string matched the mapped dotted form but at least one octet exceeded 255, or the supplied value was not a string. Check whether the input was transformed or malformed before it reached the helper. If your application needs a different invalid-input policy, implement it explicitly and keep it distinct from the “not mapped” case.
Local and production values differ
Address presentation can vary with the operating system, listener and DNS configuration, or network path. Log the original socket value in a controlled environment and confirm which API supplied it. Avoid hard-coding a conversion assumption based on a single local result.
Rate limits or allowlists treat one client as two
Review whether one path stores plain IPv4 while another stores the same value in mapped IPv6 form. Apply the same validated canonicalization before creating comparison keys, while retaining original data if it is needed for diagnostics or audit. For proxy-derived addresses, verify the trusted-proxy policy first; canonicalizing a forged header does not make it reliable.
Or skip the browser setup
For website captures, ScreenshotNeo is a website screenshot API and MCP server; it is separate from Node’s socket-address handling. A single GET request can return a screenshot or PDF. See the ScreenshotNeo API documentation for request options.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
ScreenshotNeo accepts cookie or consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; those steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify page verdict and billing status. Its MCP server includes tools for AI agents to take screenshots, get page information, and capture PDFs. The free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots. Learn about ScreenshotNeo, or sign up free for 1,000 screenshots a month with no card.
Frequently Asked Questions
Does ::ffff:127.0.0.1 mean the connection is not IPv4?
No. It is the IPv4 address represented in IPv4-mapped IPv6 form; the embedded IPv4 value is 127.0.0.1.
Will every IPv4 client appear as an IPv4-mapped IPv6 address in Node.js?
No. The representation depends on the operating system, listener configuration, DNS options, and proxy topology.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →

