Generador de archivo hosts
Genera entradas limpias para pruebas locales en segundos.
Pega filas o sube un CSV; la salida se actualiza en tiempo real.
Entradas del archivo hosts
Agrega un IP + dominio por fila. Se crean filas nuevas automáticamente.
Salida del archivo hosts
Copia y pega en tu archivo hosts.
Carga masiva CSV
Sube un CSV para llenar las entradas.
Ejemplo: 203.0.113.10,example.com
¿Qué es el archivo hosts?
El archivo hosts mapea dominios a IPs localmente para pruebas.
Ubicaciones comunes:
C:\Windows\System32\drivers\etc\hosts/etc/hosts
En Windows, edita como Administrador.
powershell -Command "Start-Process notepad -Verb runAs -ArgumentList 'C:\Windows\System32\drivers\etc\hosts'"
Limpiar caché DNS
Después de actualizar el hosts, limpia la caché DNS.
ipconfig /flushdnssudo dscacheutil -flushcache; sudo killall -HUP mDNSRespondersudo systemd-resolve --flush-caches
When to use a hosts file vs a preview URL
The hosts file is the simplest, oldest way to point a domain at a specific IP without changing DNS — but it only works on the machine you edit. If you're doing a migration alone and just need to verify the new server responds correctly to your domain, editing your hosts file gets you there in 10 seconds. The hosts file generator above produces correctly-formatted entries you paste into /etc/hosts (Linux/macOS) or C:\\Windows\\System32\\drivers\\etc\\hosts (Windows).
Switch to a preview URL from hostsclick.com when: (1) the client or QA team needs to see the new server too — they can't edit your hosts file; (2) you need real SSL handshake against the new server's actual cert (hosts file alone produces a name-mismatch warning unless you import the cert); (3) you're testing on mobile or a device without admin rights; (4) you want a record of who accessed the preview, when, from where (Pro analytics).
Hosts file location by OS
- Linux:
/etc/hosts— edit withsudo nano /etc/hostsorsudo vi /etc/hosts. - macOS:
/etc/hosts(same as Linux). After editing, runsudo dscacheutil -flushcache; sudo killall -HUP mDNSResponderto clear the resolver cache. - Windows 10/11:
C:\\Windows\\System32\\drivers\\etc\\hosts— must open Notepad as Administrator (right-click → Run as administrator) before opening the file. - Android (rooted):
/system/etc/hosts— requires root. Most users use a VPN-based DNS override instead (e.g., Hosts Go, AdGuard). - iOS: not directly editable. Use a config profile or a local Pi-hole/AdGuard at the router level.
Why your hosts file edits aren't working
Most hosts file frustrations come from caching. Browsers, the OS resolver, and any local DNS resolver each cache lookups separately. A typical "hosts file edit not working" debug:
- Verify file syntax: each line is
IP hostname [aliases], tab or space separated, comments start with#. - Save with no trailing junk. Windows Notepad sometimes saves with
.txtsuffix — confirm the actual filename has no extension. - Flush OS resolver cache (commands in the section above).
- Quit and restart your browser entirely. Chrome's internal DNS cache survives soft reload.
- Check for VPN: many corporate VPNs route DNS through their own servers, ignoring local hosts.
- Check for IPv6: if both IPv4 and IPv6 entries exist, OS may prefer the wrong one. Add an explicit IPv6 line or comment out IPv6.
Hosts file with subdomains and ports
The hosts file maps hostnames to IPs. It can't specify ports, paths, or protocols. To preview a site running on a non-standard port (e.g., a staging app on 8080), you still need a hostname pointing at the IP via hosts file, then use the port in your URL: http://example.com:8080. For SSL on non-standard ports, you'll hit cert mismatch warnings unless the cert covers the host. hosts.click Pro supports custom ports in preview URLs natively, no hosts-file edits needed.
Removing entries cleanly after migration
The most common post-migration bug is forgetting to remove a hosts file entry. Your machine continues hitting the old test IP for weeks until you wonder why analytics show one fewer visitor than the rest of the team. After DNS cutover completes, edit the file again and either delete the line or comment it out with # at the start. Flush DNS cache. Verify with ping example.com that the IP returned matches the new public DNS, not the hosts file value.