Rate Exchange Calculator

Currency Exchange Rate Calculator

Use this calculator to quickly convert between different currencies based on real-time exchange rates. Simply enter the amount you wish to convert and select the currencies. The calculator will display the converted amount instantly.

USD – United States Dollar EUR – Euro GBP – British Pound JPY – Japanese Yen CAD – Canadian Dollar AUD – Australian Dollar CHF – Swiss Franc CNY – Chinese Yuan SEK – Swedish Krona NZD – New Zealand Dollar
USD – United States Dollar EUR – Euro GBP – British Pound JPY – Japanese Yen CAD – Canadian Dollar AUD – Australian Dollar CHF – Swiss Franc CNY – Chinese Yuan SEK – Swedish Krona NZD – New Zealand Dollar
var exchangeRates = { "USD": { "EUR": 0.93, "GBP": 0.79, "JPY": 157.00, "CAD": 1.37, "AUD": 1.51, "CHF": 0.90, "CNY": 7.24, "SEK": 10.50, "NZD": 1.63 }, "EUR": { "USD": 1.08, "GBP": 0.85, "JPY": 169.00, "CAD": 1.47, "AUD": 1.62, "CHF": 0.97, "CNY": 7.80, "SEK": 11.30, "NZD": 1.75 }, "GBP": { "USD": 1.27, "EUR": 1.18, "JPY": 199.00, "CAD": 1.73, "AUD": 1.91, "CHF": 1.14, "CNY": 9.19, "SEK": 13.30, "NZD": 2.06 }, "JPY": { "USD": 0.0064, "EUR": 0.0059, "GBP": 0.0050, "CAD": 0.0087, "AUD": 0.0096, "CHF": 0.0057, "CNY": 0.046, "SEK": 0.067, "NZD": 0.10 }, "CAD": { "USD": 0.73, "EUR": 0.68, "GBP": 0.58, "JPY": 115.00, "AUD": 1.10, "CHF": 0.66, "CNY": 5.28, "SEK": 7.66, "NZD": 1.19 }, "AUD": { "USD": 0.66, "EUR": 0.61, "GBP": 0.52, "JPY": 104.00, "CAD": 0.91, "CHF": 0.59, "CNY": 4.78, "SEK": 6.94, "NZD": 1.08 }, "CHF": { "USD": 1.11, "EUR": 1.03, "GBP": 0.88, "JPY": 139.00, "CAD": 1.50, "AUD": 1.68, "CNY": 7.99, "SEK": 11.59, "NZD": 1.79 }, "CNY": { "USD": 0.14, "EUR": 0.13, "GBP": 0.11, "JPY": 20.00, "CAD": 0.19, "AUD": 0.21, "CHF": 0.13, "SEK": 1.45, "NZD": 0.22 }, "SEK": { "USD": 0.095, "EUR": 0.088, "GBP": 0.075, "JPY": 15.20, "CAD": 0.13, "AUD": 0.14, "CHF": 0.086, "CNY": 0.69, "NZD": 0.15 }, "NZD": { "USD": 0.61, "EUR": 0.57, "GBP": 0.48, "JPY": 123.00, "CAD": 0.84, "AUD": 0.92, "CHF": 0.56, "CNY": 4.52, "SEK": 6.49 } }; function calculateExchange() { var amount = parseFloat(document.getElementById("amountToConvert").value); var fromCurrency = document.getElementById("fromCurrency").value; var toCurrency = document.getElementById("toCurrency").value; var resultDiv = document.getElementById("result"); if (isNaN(amount) || amount <= 0) { resultDiv.innerHTML = "Please enter a valid positive amount."; return; } if (fromCurrency === toCurrency) { resultDiv.innerHTML = amount.toFixed(2) + " " + fromCurrency + " is equal to " + amount.toFixed(2) + " " + toCurrency; return; } var rate = 1; if (exchangeRates[fromCurrency] && exchangeRates[fromCurrency][toCurrency]) { rate = exchangeRates[fromCurrency][toCurrency]; } else { resultDiv.innerHTML = "Exchange rate not available for this pair."; return; } var convertedAmount = amount * rate; resultDiv.innerHTML = amount.toFixed(2) + " " + fromCurrency + " is equal to " + convertedAmount.toFixed(2) + " " + toCurrency; } // Initial calculation on page load for default values window.onload = function() { calculateExchange(); }; .exchange-calculator-container { font-family: sans-serif; max-width: 500px; margin: 20px auto; padding: 20px; border: 1px solid #ddd; border-radius: 8px; background-color: #f9f9f9; box-shadow: 0 2px 4px rgba(0,0,0,0.1); } .exchange-calculator-container h2 { text-align: center; color: #333; margin-bottom: 15px; } .exchange-calculator-container p { text-align: center; color: #555; font-size: 0.95em; margin-bottom: 25px; } .calculator-inputs { display: flex; flex-direction: column; gap: 15px; margin-bottom: 20px; } .input-group { display: flex; flex-direction: column; } .input-group label { margin-bottom: 8px; font-weight: bold; color: #444; } .input-group input[type="number"], .input-group select { padding: 10px; border: 1px solid #ccc; border-radius: 4px; font-size: 1em; width: 100%; box-sizing: border-box; /* Include padding and border in the element's total width and height */ } .exchange-calculator-container button { display: block; width: 100%; padding: 12px 20px; background-color: #007bff; color: white; border: none; border-radius: 4px; font-size: 1.1em; cursor: pointer; transition: background-color 0.3s ease; margin-bottom: 20px; } .exchange-calculator-container button:hover { background-color: #0056b3; } .exchange-result { text-align: center; font-size: 1.1em; font-weight: bold; color: #333; padding: 15px; border: 1px dashed #ddd; border-radius: 4px; background-color: #fff; }

Leave a Comment