<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Global Currency Converter | Economic News</title>
<meta name="description" content="Real-time currency converter with exchange rates for all world currencies. Accurate financial tool for traders and investors.">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
body {
background: linear-gradient(135deg, #0a1929 0%, #1a3a5f 100%);
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
padding: 20px;
color: #f0f0f0;
line-height: 1.6;
}
.converter-container {
background: linear-gradient(145deg, #001a33 0%, #00264d 100%);
border-radius: 20px;
box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
width: 100%;
max-width: 550px;
overflow: hidden;
position: relative;
border: 1px solid rgba(212, 175, 55, 0.3);
}
.converter-header {
background: linear-gradient(90deg, #0a2e4a 0%, #12395c 100%);
padding: 25px;
text-align: center;
border-bottom: 2px solid #d4af37;
position: relative;
overflow: hidden;
}
.converter-header::before {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 4px;
background: linear-gradient(90deg, #d4af37, #c19e1f, #556b2f);
}
.converter-header h1 {
font-size: 2.3rem;
font-weight: 700;
margin-bottom: 10px;
background: linear-gradient(45deg, #d4af37, #f5f5dc);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
letter-spacing: 0.5px;
}
.converter-header p {
font-size: 1.1rem;
opacity: 0.85;
color: #e0e0e0;
max-width: 80%;
margin: 0 auto;
font-weight: 300;
}
.converter-body {
padding: 25px;
}
.input-group {
margin-bottom: 25px;
}
.input-group label {
display: block;
margin-bottom: 12px;
font-weight: 500;
color: #d4af37;
font-size: 1.05rem;
}
.input-container {
display: flex;
border: 1px solid #2c4762;
border-radius: 12px;
overflow: hidden;
background: #001a33;
box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.3);
}
.amount-input {
flex: 1;
padding: 16px 20px;
border: none;
font-size: 1.2rem;
font-weight: 500;
outline: none;
background: transparent;
color: #f0f0f0;
}
.amount-input::placeholder {
color: #6b8e23;
}
.currency-select {
width: 140px;
padding: 0 15px;
border: none;
border-left: 1px solid #2c4762;
background: #001a33;
font-size: 1rem;
font-weight: 500;
cursor: pointer;
outline: none;
color: #f0f0f0;
appearance: none;
background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d4af37' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
background-repeat: no-repeat;
background-position: right 15px center;
background-size: 16px;
}
.swap-btn {
background: linear-gradient(135deg, #d4af37 0%, #c19e1f 100%);
border: none;
border-radius: 50%;
width: 55px;
height: 55px;
display: flex;
justify-content: center;
align-items: center;
margin: 0 auto 25px;
cursor: pointer;
transition: all 0.3s ease;
box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}
.swap-btn:hover {
transform: rotate(180deg) scale(1.05);
box-shadow: 0 6px 20px rgba(212, 175, 55, 0.5);
}
.swap-btn i {
font-size: 1.4rem;
color: #001a33;
}
.result-container {
background: linear-gradient(135deg, #1a3a5f 0%, #0a2e4a 100%);
border-radius: 15px;
padding: 25px;
text-align: center;
margin-top: 15px;
border: 1px solid #2c4762;
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}
.result-label {
font-size: 1rem;
color: #6b8e23;
margin-bottom: 8px;
font-weight: 500;
}
.result-amount {
font-size: 2.6rem;
font-weight: 700;
color: #d4af37;
margin: 10px 0;
letter-spacing: 0.5px;
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}
.result-text {
color: #a8c3d1;
font-size: 1.1rem;
margin-top: 15px;
}
.update-info {
text-align: center;
margin-top: 25px;
font-size: 0.9rem;
color: #6b8e23;
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
}
.converter-footer {
background: rgba(0, 26, 51, 0.8);
padding: 20px 25px;
text-align: center;
font-size: 0.9rem;
color: #8a9ba8;
border-top: 1px solid #2c4762;
}
.converter-footer a {
color: #d4af37;
text-decoration: none;
transition: all 0.3s ease;
}
.converter-footer a:hover {
color: #6b8e23;
text-decoration: underline;
}
.seo-text {
margin-top: 25px;
padding: 20px;
background: rgba(0, 26, 51, 0.5);
border-radius: 12px;
border: 1px solid #2c4762;
}
.seo-text h2 {
color: #d4af37;
margin-bottom: 15px;
font-size: 1.4rem;
}
.seo-text p {
color: #c8d4df;
margin-bottom: 12px;
line-height: 1.7;
font-size: 0.95rem;
}
/* Responsive design */
@media (max-width: 600px) {
.converter-header h1 {
font-size: 1.8rem;
}
.converter-header p {
font-size: 1rem;
}
.amount-input {
padding: 14px 18px;
font-size: 1.1rem;
}
.currency-select {
width: 120px;
font-size: 0.95rem;
}
.result-amount {
font-size: 2rem;
}
.converter-body {
padding: 20px;
}
}
@media (max-width: 480px) {
.converter-header {
padding: 20px 15px;
}
.input-container {
flex-direction: column;
}
.currency-select {
width: 100%;
border-left: none;
border-top: 1px solid #2c4762;
padding: 12px 15px;
}
.result-amount {
font-size: 1.8rem;
}
}
/* Loading spinner */
.spinner {
border: 3px solid rgba(0, 0, 0, 0.1);
border-top: 3px solid #d4af37;
border-radius: 50%;
width: 30px;
height: 30px;
animation: spin 1s linear infinite;
margin: 25px auto;
display: none;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
/* Flags for currency selection */
.currency-option {
display: flex;
align-items: center;
gap: 10px;
padding: 8px 5px;
}
.currency-flag {
width: 24px;
height: 18px;
border-radius: 2px;
object-fit: cover;
}
</style>
</head>
<body>
<div class="converter-container">
<div class="converter-header">
<h1>Global Currency Converter</h1>
<p>Real-time exchange rates for all world currencies</p>
</div>
<div class="converter-body">
<div class="input-group">
<label for="amount"><i class="fas fa-coins"></i> AMOUNT TO CONVERT</label>
<div class="input-container">
<input type="number" id="amount" class="amount-input" value="1" min="0" step="0.01" placeholder="Enter amount">
<select id="from-currency" class="currency-select">
<!-- Currencies will be populated by JS -->
</select>
</div>
</div>
<div class="swap-btn" id="swap-btn" title="Swap currencies">
<i class="fas fa-exchange-alt"></i>
</div>
<div class="input-group">
<label for="result"><i class="fas fa-chart-line"></i> CONVERTED AMOUNT</label>
<div class="input-container">
<div class="amount-input" id="result" style="background: transparent; color: #d4af37; display: flex; align-items: center;">0.00</div>
<select id="to-currency" class="currency-select">
<!-- Currencies will be populated by JS -->
</select>
</div>
</div>
<div class="result-container">
<div class="result-label">CONVERSION RESULT</div>
<div class="result-amount" id="result-amount">0.00</div>
<div class="result-text" id="result-text">1 USD = 0.00 EUR</div>
</div>
<div class="spinner" id="spinner"></div>
<div class="update-info">
<i class="fas fa-sync-alt"></i> Exchange rates update every minute • Data provided by ExchangeRate-API
</div>
<div class="seo-text">
<h2><i class="fas fa-globe-americas"></i> Global Currency Exchange</h2>
<p>Our real-time currency converter provides accurate exchange rates for all major world currencies, including USD, EUR, GBP, JPY, and more. Perfect for travelers, investors, and financial professionals.</p>
<p>Exchange rates are updated every minute from reliable financial sources to ensure you always have the most current information for your currency conversions.</p>
</div>
</div>
<div class="converter-footer">
<p>© 2023 Economic News Network | This financial tool uses real-time exchange rates. Rates may vary between financial institutions.</p>
<p>For market news and financial insights, visit <a href="#">EconomicNews.com</a></p>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
// Elements
const amountInput = document.getElementById('amount');
const fromCurrency = document.getElementById('from-currency');
const toCurrency = document.getElementById('to-currency');
const resultAmount = document.getElementById('result-amount');
const resultText = document.getElementById('result-text');
const swapBtn = document.getElementById('swap-btn');
const spinner = document.getElementById('spinner');
// World currencies (ISO codes and names)
const currencies = [
{code: "USD", name: "US Dollar"},
{code: "EUR", name: "Euro"},
{code: "GBP", name: "British Pound"},
{code: "JPY", name: "Japanese Yen"},
{code: "AUD", name: "Australian Dollar"},
{code: "CAD", name: "Canadian Dollar"},
{code: "CHF", name: "Swiss Franc"},
{code: "CNY", name: "Chinese Yuan"},
{code: "INR", name: "Indian Rupee"},
{code: "MXN", name: "Mexican Peso"},
{code: "SGD", name: "Singapore Dollar"},
{code: "NZD", name: "New Zealand Dollar"},
{code: "BRL", name: "Brazilian Real"},
{code: "RUB", name: "Russian Ruble"},
{code: "KRW", name: "South Korean Won"},
{code: "ZAR", name: "South African Rand"},
{code: "SEK", name: "Swedish Krona"},
{code: "NOK", name: "Norwegian Krone"},
{code: "AED", name: "UAE Dirham"},
{code: "SAR", name: "Saudi Riyal"},
{code: "TRY", name: "Turkish Lira"},
{code: "THB", name: "Thai Baht"},
{code: "PLN", name: "Polish Złoty"},
{code: "HKD", name: "Hong Kong Dollar"},
{code: "IDR", name: "Indonesian Rupiah"},
{code: "MYR", name: "Malaysian Ringgit"},
{code: "HUF", name: "Hungarian Forint"},
{code: "CZK", name: "Czech Koruna"},
{code: "DKK", name: "Danish Krone"},
{code: "ILS", name: "Israeli Shekel"},
{code: "PHP", name: "Philippine Peso"},
{code: "CLP", name: "Chilean Peso"},
{code: "EGP", name: "Egyptian Pound"},
{code: "PKR", name: "Pakistani Rupee"},
{code: "COP", name: "Colombian Peso"},
{code: "VND", name: "Vietnamese Dong"},
{code: "BDT", name: "Bangladeshi Taka"},
{code: "ARS", name: "Argentine Peso"},
{code: "RON", name: "Romanian Leu"},
{code: "UAH", name: "Ukrainian Hryvnia"}
];
// Populate currency dropdowns
function populateCurrencyDropdowns() {
currencies.forEach(currency => {
const fromOption = document.createElement('option');
fromOption.value = currency.code;
fromOption.textContent = `${currency.code} - ${currency.name}`;
const toOption = document.createElement('option');
toOption.value = currency.code;
toOption.textContent = `${currency.code} - ${currency.name}`;
fromCurrency.appendChild(fromOption);
toCurrency.appendChild(toOption);
});
// Set default currencies
fromCurrency.value = "USD";
toCurrency.value = "EUR";
}
// Initial population
populateCurrencyDropdowns();
// Initial conversion
convertCurrency();
// Event listeners
amountInput.addEventListener('input', convertCurrency);
fromCurrency.addEventListener('change', convertCurrency);
toCurrency.addEventListener('change', convertCurrency);
swapBtn.addEventListener('click', function() {
// Swap currencies
const temp = fromCurrency.value;
fromCurrency.value = toCurrency.value;
toCurrency.value = temp;
// Convert after swap
convertCurrency();
});
// Currency conversion function
async function convertCurrency() {
const amount = parseFloat(amountInput.value) || 1;
const from = fromCurrency.value;
const to = toCurrency.value;
// Show loading spinner
spinner.style.display = 'block';
resultAmount.textContent = '...';
try {
// Get exchange rate from API
const response = await fetch(`https://open.er-api.com/v6/latest/${from}`);
const data = await response.json();
if (data.result === 'success') {
const rate = data.rates[to];
const convertedAmount = (amount * rate).toFixed(2);
// Format large numbers with commas
const formattedAmount = new Intl.NumberFormat('en-US', {
maximumFractionDigits: 2
}).format(convertedAmount);
// Update the UI
resultAmount.textContent = formattedAmount;
resultText.textContent = `1 ${from} = ${rate.toFixed(4)} ${to}`;
// Hide spinner
spinner.style.display = 'none';
} else {
throw new Error('Failed to fetch exchange rates');
}
} catch (error) {
console.error('Error:', error);
resultAmount.textContent = 'Error';
resultText.textContent = 'Failed to fetch exchange rates. Please try again.';
spinner.style.display = 'none';
}
}
// Update rates every minute
setInterval(convertCurrency, 60000);
});
</script>
</body>
</html>