To convert an IPv4 address to an IPv6 address, place the original 32 IPv4 bits after 80 zero bits and the 16-bit FFFF marker, creating a 128-bit RFC 4291 IPv4-mapped IPv6 address. This lets an IPv4 node be represented inside an IPv6-sized address structure, but it does not create a new native or globally routable IPv6 address.

Mapped addresses matter in APIs and dual-stack software, where an IPv4 peer can be exposed through an IPv6 socket. The prefix identifies the value as mapped, while the final 32 bits preserve the original IPv4 address. The representation alone does not allocate address space, configure a route, translate traffic, or publish an IPv4-only service on the public IPv6 Internet.

how to convert ipv4 to ipv6 address
How to Convert IPv4 to IPv6 Address: Mapped Format

The exact bit layout behind the conversion

The rule comes from RFC 4291 section 2.5.5.2: 80 zero bits, then 16 one bits written as FFFF, then the original 32 IPv4 bits. The widths are fixed, so the result is always 128 bits even though its text can be compressed in several ways.

The same bit sequence can be written in three useful notations:

Notation Structure What it makes visible
Mixed ::ffff: followed by the final 32 bits in dotted-decimal form The original four IPv4 octets remain easy to recognize
Compressed hexadecimal ::ffff: followed by the two low-order 16-bit words, with valid leading zeroes omitted A shorter hexadecimal representation of the same address
Expanded hexadecimal Eight 16-bit groups, each padded to four hexadecimal digits Every group and zero segment is shown explicitly

In compressed output, the double colon replaces the run of zero groups, and leading zeroes within a hexadecimal group may be omitted. The expanded output pads every 16-bit group to four digits. The converter uses lowercase hexadecimal consistently and presents the results in a copy-friendly canonical style.

Convert one IPv4 address in four steps

Use the IPv4 to IPv6 Converter to generate all three mapped forms from one numeric input. It runs entirely in the browser, performs no lookup, and stores nothing.

  1. Enter one strict IPv4 address. Use exactly four decimal octets from 0 through 255, separated by dots. Do not include surrounding spaces, a sign, shorthand such as one or two octets, hexadecimal digits, leading zeroes, or a CIDR suffix. Rejecting leading-zero forms also removes legacy octal ambiguity. Hostnames are not resolved because DNS results introduce network dependence and can change over time.
  2. Create the RFC 4291 mapped representation. The converter combines each pair of IPv4 octets into one low-order 16-bit word, prefixes those words with 80 zero bits and FFFF, and preserves the complete 128-bit address.
  3. Choose the destination notation. Select mixed notation for dotted decimal, compressed hexadecimal for the shorter canonical-style value, or expanded hexadecimal when every group should be visible.
  4. Copy, parse, and normalize. Use the separate copy control for the selected output, then parse it with the destination platform's maintained IP-address library and compare the normalized result. Confirm that the consumer accepts mapped IPv6 addresses before using the value in policy or production configuration.

That final validation matters because an API, socket layer, access-control list, database, proxy, or framework can preserve, normalize, or reject the mixed spelling. Producing a syntactically valid mapped address does not prove that the receiving component applies the intended IPv4 or IPv6 semantics.

Worked mapped-address example

Take 192.0.2.1. Pairing the octets gives 192.0 as c000 and 2.1 as 0201, so the low-order 32 bits become the 16-bit words c000 and 0201. Substituting them into the mapped layout gives:

  • Layout: 80 zero bits || FFFF || c000 || 0201
  • Mixed notation: ::ffff:192.0.2.1
  • Compressed hexadecimal: ::ffff:c000:201
  • Expanded hexadecimal: 0000:0000:0000:0000:0000:ffff:c000:0201

The compressed form removes the leading zeroes from the final word, while the expanded form pads all eight 16-bit groups. These lines are alternative spellings of one address, not three different destinations.

Match the output to its destination

Choose the notation according to the parser and workflow that will consume it. If a system rewrites equivalent addresses, compare parsed values rather than raw text.

Destination What to verify Important caveat
Configuration file Whether its parser accepts mapped IPv6 and how it normalizes the value The stored text may use a different equivalent spelling
API or socket Whether the application exposes or accepts an IPv4 peer as mapped IPv6 Behavior varies by socket API and framework
Database Whether the column type and address parser support IPv6 and the mixed form A database may normalize, preserve, or reject the mixed notation
Logs and diagnostics How the logging component renders the parsed address Equivalent bits may appear as different text
Authorization or rate limits Whether the rule engine understands mapped IPv4 semantics A prefix-only string check is insufficient

Use the converter's separate copy controls so the intended spelling enters the configuration file, test, database, or diagnostic note. If the destination normalizes addresses, accept that normalized form as the consumer's representation rather than requiring raw-text equality.

Parse and normalize before comparison

Use a maintained address library at the point where the value is accepted. Python's IPv6Address.ipv4_mapped documentation shows how a parsed IPv6 object can expose mapped IPv4 semantics, but your own consumer may handle mapped values differently.

For a production handoff, record whether the destination expects mapped addresses at all. Test the exact API, framework, proxy, access-control list, database parser, and logging path involved. Compare parsed objects or normalized forms when equality matters, and account for mapped IPv4 semantics before applying private-address, loopback, denylist, or rate-limit rules.

What the mapped conversion does not provide

  • Native IPv6 assignment: The output does not allocate native IPv6 space or become a regular IPv6 subnet address.
  • Routing or packet translation: It does not configure a route, translate packets, or establish reachability.
  • Public exposure: It does not make an IPv4-only service reachable through the public IPv6 Internet.
  • A transition mechanism: IPv4-mapped addresses are not NAT64, 6to4, SIIT translation, or DNS64 synthesis, all of which have different prefixes and operational meanings.

Do not confuse this format with the older IPv4-compatible form. RFC 4291 deprecates the compatible form and separately defines the mapped FFFF marker. The converter deliberately emits only mapped addresses so a generic conversion control cannot silently choose a deployment mechanism.

Classify the embedded IPv4 separately

The mapped representation does not change the scope of the embedded IPv4 address. If a policy distinguishes private, loopback, multicast, documentation, or globally reachable ranges, classify the original IPv4 address separately rather than assuming that its IPv6-sized spelling has a different meaning.

Some socket APIs expose an IPv4 peer as an IPv4-mapped IPv6 address when an IPv6 listener accepts both protocol families. Access controls, logs, databases, proxies, and frameworks may then normalize, preserve, or reject the mixed form. Apply authorization rules to the parsed value with mapped IPv4 semantics in mind, and test the exact component that makes the decision.

Use a separate process for other IP tasks

For native IPv6 assignment, subnet planning, or transition-service configuration, use standards and tools designed for that separate task. A mapped address is a representation, not a connectivity plan. Before production use, cross-check the converter result with the destination platform's IP-address library, document whether the consumer expects mapped addresses, and leave broader network architecture decisions to an operator who understands the local stack and transition design.

Related reading: How to Find an IPv6 Subnet Mask Without Guessing.

Related reading: How to Get the MAC Address of a PC: Windows, macOS, Linux.