IPv4 to IPv6 Converter - FreeToolsCraft
Convert IPv4 addresses to IPv6 format instantly. No data leaves your browser.
Enter IPv4 Address
Enter a valid IPv4 address (format: xxx.xxx.xxx.xxx where xxx is 0-255)
Conversion Results
Hexadecimal Representation:
-
Explanation: This IPv6 address is in the 6to4 address space, which allows IPv6 packets to be transmitted over IPv4 networks.
Download & Copy Options
How It Works
6to4 Conversion
Uses 6to4 addressing (2002::/16) to map IPv4 to IPv6 format.
Complete Privacy
All processing in your browser. Zero data sent to servers.
Multiple Formats
Export results in TXT, HTML, CSV, or PDF format.
`;
const blob = new Blob([content], { type: 'text/html;charset=utf-8' });
saveAs(blob, `ipv4-to-ipv6-${conversionResults.originalIPv4.replace(/\./g, '-')}-freetoolscraft.html`);
}
// Download as CSV file
function downloadCSV() {
if (!conversionResults.originalIPv4) {
alert('No results to download. Please convert an IPv4 address first.');
return;
}
const content = `Field,Value
Generated By,freetoolscraft.com
Website,https://freetoolscraft.com
Tool,IPv4 to IPv6 Converter
Original IPv4,${conversionResults.originalIPv4}
Expanded IPv6,${conversionResults.expandedIPv6}
Hexadecimal Representation,${conversionResults.hexRepresentation}
Binary Representation,${conversionResults.binaryRepresentation}
Explanation,"This IPv6 address is in the 6to4 address space, which allows IPv6 packets to be transmitted over IPv4 networks."
Generated Date,${new Date().toLocaleDateString()}
Generated Time,${new Date().toLocaleTimeString()}`;
const blob = new Blob([content], { type: 'text/csv;charset=utf-8' });
saveAs(blob, `ipv4-to-ipv6-${conversionResults.originalIPv4.replace(/\./g, '-')}-freetoolscraft.csv`);
}
// Download as PDF file
function downloadPDF() {
if (!conversionResults.originalIPv4) {
alert('No results to download. Please convert an IPv4 address first.');
return;
}
// Create PDF using jsPDF
const { jsPDF } = window.jspdf;
const doc = new jsPDF();
// Title
doc.setFontSize(20);
doc.setTextColor(44, 62, 80);
doc.text("IPv4 to IPv6 Conversion Results", 20, 20);
// Website name
doc.setFontSize(12);
doc.setTextColor(102, 126, 234);
doc.text("Generated by: freetoolscraft.com", 20, 30);
// Line under title
doc.setDrawColor(52, 152, 219);
doc.setLineWidth(0.5);
doc.line(20, 35, 190, 35);
// Conversion details
doc.setFontSize(12);
doc.setTextColor(0, 0, 0);
let yPos = 45;
// Original IPv4
doc.setFont("helvetica", "bold");
doc.text("Original IPv4:", 20, yPos);
doc.setFont("helvetica", "normal");
doc.text(conversionResults.originalIPv4, 80, yPos);
yPos += 10;
// Expanded IPv6
doc.setFont("helvetica", "bold");
doc.text("Expanded IPv6:", 20, yPos);
doc.setFont("helvetica", "normal");
doc.text(conversionResults.expandedIPv6, 80, yPos);
yPos += 10;
// Hexadecimal Representation
doc.setFont("helvetica", "bold");
doc.text("Hexadecimal:", 20, yPos);
doc.setFont("helvetica", "normal");
doc.text(conversionResults.hexRepresentation, 80, yPos);
yPos += 10;
// Binary Representation
doc.setFont("helvetica", "bold");
doc.text("Binary:", 20, yPos);
doc.setFont("helvetica", "normal");
// Handle binary representation (might be long)
const binaryText = conversionResults.binaryRepresentation;
if (binaryText.length > 50) {
// Split binary into two lines if too long
const midpoint = Math.floor(binaryText.length / 2);
const firstHalf = binaryText.substring(0, midpoint);
const secondHalf = binaryText.substring(midpoint);
doc.text(firstHalf, 80, yPos);
yPos += 7;
doc.text(secondHalf, 80, yPos);
yPos += 10;
} else {
doc.text(binaryText, 80, yPos);
yPos += 10;
}
// Explanation
yPos += 5;
doc.setFont("helvetica", "bold");
doc.text("Explanation:", 20, yPos);
doc.setFont("helvetica", "normal");
const explanation = "This IPv6 address is in the 6to4 address space, which allows IPv6 packets to be transmitted over IPv4 networks.";
const splitExplanation = doc.splitTextToSize(explanation, 150);
doc.text(splitExplanation, 20, yPos + 7);
// Footer
const pageHeight = doc.internal.pageSize.height;
doc.setFontSize(10);
doc.setTextColor(100, 100, 100);
doc.text("Generated by freetoolscraft.com - Free Online Tools", 20, pageHeight - 30);
doc.text(`Date: ${new Date().toLocaleDateString()} | Time: ${new Date().toLocaleTimeString()}`, 20, pageHeight - 25);
doc.text("Tool: IPv4 to IPv6 Converter | Website: https://freetoolscraft.com", 20, pageHeight - 20);
// Save the PDF
doc.save(`ipv4-to-ipv6-${conversionResults.originalIPv4.replace(/\./g, '-')}-freetoolscraft.pdf`);
}
// Event Listeners
convertBtn.addEventListener('click', handleConversion);
clearBtn.addEventListener('click', clearAll);
detectIpBtn.addEventListener('click', detectUserIP);
ipv4Input.addEventListener('keyup', (event) => {
if (event.key === 'Enter') {
handleConversion();
}
});
// Download buttons
copyBtn.addEventListener('click', copyToClipboard);
txtBtn.addEventListener('click', downloadTXT);
htmlBtn.addEventListener('click', downloadHTML);
csvBtn.addEventListener('click', downloadCSV);
pdfBtn.addEventListener('click', downloadPDF);
// Auto-convert as user types (with debounce)
let debounceTimer;
ipv4Input.addEventListener('input', () => {
clearTimeout(debounceTimer);
debounceTimer = setTimeout(() => {
const ipv4 = ipv4Input.value.trim();
if (ipv4 && validateIPv4(ipv4)) {
handleConversion();
}
}, 500);
});
// Initialize with an example (optional)
window.addEventListener('DOMContentLoaded', () => {
// You can uncomment this to preload an example
// ipv4Input.value = "192.168.1.1";
});