My Android device is the Nexus One. But this should apply to all current Android devices.

How do I change the name of my Android device?

When I connect to my wireless router's client tables, my android devices is listed for example as: android_1234567890abedfc. I'd like to give it a more readable name.


7 Answers 7


To change the hostname (device name) you have to use the terminal (as root):

For Eclair (2.1): echo MYNAME > /proc/sys/kernel/hostname

For Froyo (2.2): (works also on most 2.3) setprop net.hostname MYNAME

Then restart your wi-fi. To see the change, type uname -a

some devices needs reboot for work!

  • Does this work on jelly bean?
    – jrg
    Commented Sep 1, 2012 at 3:43
  • 5
    This works, but does not persist on reboot.
    – palswim
    Commented Aug 8, 2013 at 18:16
  • 1
    uname -a doesn't show the hostname for me, though it does say localhost. what do you expect it to show?
    – endolith
    Commented Feb 28, 2016 at 0:11


  • getprop net.hostname (Android System Hostname, likely android_24412414 type name)
  • echo $HOSTNAME (shell/terminal/env hostname, likely ro.product.device from build.prop)
  • cat /proc/sys/kernel/hostname (Linux System Hostname, likely localhost)
  • head /etc/hosts (Linux System Hostname, likely localhost)
  • hostname (Command not always installed, if installed via busy box, will read /proc/sys/kernel/hostname)

Depends on which version of Android you have.

Android 4.0 and Above

Newer versions will use the right build.prop entry. Well, that is to say, Android reads the build.prop as it's normal boot process. Once the Connectivity Service runs, it checks to see if net.hostname is set in the Settings, then if empty, then it uses the "android_" + (permanent) android ID. So that's all you need to do.

Add net.hostname=HOSTNAMEHERE to /system/build.prop (Root may be needed). Leave a blank line at the end of the file.

Kitkat's ConnectivityService.java, notice the IF isEmpty statement:

    // setup our unique device name
    if (TextUtils.isEmpty(SystemProperties.get("net.hostname"))) {
        String id = Settings.Secure.getString(context.getContentResolver(),
        if (id != null && id.length() > 0) {
            String name = new String("android-").concat(id);
            SystemProperties.set("net.hostname", name);

Android 2.3 and Below

Older versions, Gingerbread, Froyo, etc, just clobber it. It doesn't bother to check. It will set net.hostname to android_24412414... no matter what. So you will need to change it after that Connectivity Service has finished loading. Luckily, it only runs the startup once, not on every new connection. So we just need to run setprop net.hostname HOSTNAMEHERE after that for it to stick. Unfortunately, it runs fairly late in the boot process, so you need something that will make the changes on boot_complete. Most likely an App that runs by itself.

Froyo's ConnectivityService.java:

    // setup our unique device name
    String id = Settings.Secure.getString(context.getContentResolver(),
    if (id != null && id.length() > 0) {
        String name = new String("android_").concat(id);
        SystemProperties.set("net.hostname", name);

But then there is another issue.

The net.hostname setting, is not copied to the entire system! If you use a console/terminal application, you might not get the same hostname. My phone, a Samsung Sidekick 4G (semi-Galaxy S based) has an init.rc which runs hostname localhost, so all underneath commands will not see either your build.prop hostname or the android_id hostname! So you need to set that too.

hostname HOSTNAMEHERE or echo HOSTNAMEHERE > /proc/sys/kernel/hostname

Note: Depending on how you are doing it, you'll need to run the above command as root in order for it to work. Init.rc is typically on the read only system partition, so root access is needed to edit it.

The dhcpcd command, which is run to get a dhcp address, will not update to a hostname provided by the server (That can be fixed by adding the right dhcpcd-run-hooks and dhcpcd.conf), and it will not provide a hostname to the dhcp server if $(hostname) (The hostname command) is blank or localhost, and it does not internally use net.hostname. libnetutils is used for calling dhcpcd with -h "net.hostname", but if for some reason it decides not to call with -h, DHCPCD WILL STILL SEND THE SYSTEM HOSTNAME via gethostname(), as long as it's not "(none)", "localhost", or empty. On Stock Froyo anyway. Samsung screwed the pooch on some devices like mine. No hostname pass through, forced network time, etc.

My Solution for Gingerbread and below Samsung, Edit the DHCP Client Daemon config:

The last thing you can do is edit /etc/dhcpcd/dhcpcd.conf. If you add hostname YOURHOSTNAME to the file, it will use that, unless a hostname is given on the commandline. This won't fix the android_234etc issue, but will if the hostname is localhost (My problem, since Samsung screwed libnetutils and localhost in init.rc). You will need Root, but this works across reboots. This won't work if dhcpcd is called with -h Hostname option.

  • Who uses Android 2.3? Does this version still work in 2020? The links from 2008 still work, this is backward. Commented Nov 12, 2020 at 20:21
  • @user3123159 well i did answer this in 2014...
    – cde
    Commented May 21, 2023 at 11:34

I found a way to do this on my rooted Nexus 7 with 4.2.2. The setting is saved persistently and works throughout reboots.
Source: http://nileshgr.com/2012/10/13/how-to-change-wifi-host-name-of-your-android-device

  1. Note that the device must be rooted to use adb
  2. Run adb pull /system/build.prop
  3. Edit the build.prop file and append net.hostname=NewHostname
  4. Run adb push build.prop /sdcard/build.prop (or /mnt/sdcard, if it fails)
  5. Run adb shell and execute the following commands:
    $ su
    # mount -o rw,remount /system
    # cp /sdcard/build.prop /system/build.prop (or /mnt/sdcard if you used that previously)
    # mount -o ro,remount /system
    # exit
  6. Reboot the device
  • This was fixed in newer versions of Android. It checks net.hostname from build.prop. Older Android versions do not (Mainly Froyo, maybe Gingerbread).
    – cde
    Commented Jan 4, 2014 at 12:22
  • ICS isnt 4.2.2, that would be JB
    – HasH_BrowN
    Commented Sep 27, 2014 at 20:17
  • an easier way to do this is to use the setprop command via a root shell on the device: for example setprop net.hostname NewHostName
    – Mark
    Commented Oct 16, 2014 at 0:00
  • 1
    @mark that would be clobbered on reboot. This answer is a permanent version.
    – cde
    Commented Aug 7, 2016 at 6:26

This works on CyanogenMod and probably other modified ROMs but not stock AOSP ROMs:

Go to Settings > Developer Options and scroll down to Device Hostname. Root is not needed.

(Click image to enlarge)


  • 2
    Yeah, you can't do this on an Acer A100 tablet running Android 4.0.3. In fact, it doesn't even have "Device hostname" in the Developer Options.
    – bgmCoder
    Commented Nov 4, 2015 at 4:14

I have not ran stock in a long time but in Application Settings > Development you will see the option 'Device hostname'.

  • on what versions of Android? When I look at development options on my Droid 3 (Android 2.3.4), I don't have that option. Commented Mar 19, 2012 at 15:24
  • 4
    This works on CyanogenMOD and probably other modified ROMs but not stock AOSP ROMs.
    – Caleb
    Commented Oct 18, 2013 at 15:50
  • Completely dependent on the manufacturer and builder, as well as android version.
    – cde
    Commented Jan 4, 2014 at 12:21

Go to Google Play Store. Search for "hostname", and download hostname changer app.

Must be rooted.

  • Will renaming the device mess up anything internally?
    – bgmCoder
    Commented Nov 4, 2015 at 4:13

Hostname is used to easily identify and remember hosts connected to a network. It's set on boot, e.g. from /etc/hostname on Linux based systems. Hostname is also a part of DHCPREQUEST (standardized as code 12 by IETF) which a DHCP client (Android device in our case) makes to DHCP server (WiFi router) to get an IP address assigned. DHCP server stores the hostnames to offer services like DNS. See details in How to ping a local network host by hostname?.

Android - instead of using Linux kernel's hostname service - used property net.hostname (since Android 2.2) to set a unique host name for every device which was based on android_id. This hostname property was used for DHCP handshake (as added in Android 2.2 and 4.0). In Android 6 net.hostname continued to be used (1, 2, 3, 4) in new Java DHCP client when native dhcpcd was abandoned and later service was removed in Android 7. Since Android 8 - when android_id became unique to apps - net.hostname is no more set, so a null is sent in DHCPREQUEST. See Android 8 Privacy Changes and Security Enhancements:

net.hostname is now empty and the dhcp client no longer sends a hostname

So the WiFi routers show no host names for Android 8+, neither we can set / unset / change it.

However on rooted devices you can set net.hostname manually using setprop command or add in some init's .rc file to set on every boot. Or use a third party client like busybox udhcpc to send desired hostname and other options to router. See Connecting to WiFi via ADB Shell.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .