CI Code Climate Gem Version


Yet another User-Agent string generator library.


  • Generates random but realistic User-Agent strings from known values.
  • Small and fast.
  • Zero dependencies.
  • 93% documentation coverage.
  • 99% test coverage.



Get a random User-Agent string:

user_agent = Ronin::Web::UserAgents.random
# => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.230 Safari/537.36"

Get a random Chrome User-Agent string:

user_agent =
# => "Mozilla/5.0 (Linux; Android 5.1.1; Redmi Note 7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4688.3 Mobile Safari/537.36"

Build a specific Chrome User-Agent for Android 10.0 string: '100.0.4758.81', os: :
android, os_version: '10.0')
# => "Mozilla/5.0 (Linux; Android 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4758.81 Mobile Safari/537.36"

Get a random Firefox User-Agent string:

user_agent = Ronin::Web::UserAgents.firefox.random
# => "Mozilla/5.0 (Windows NT 6.1; rv:78.0.2) Gecko/20100101 Firefox/78.0.2"

Build a specific Firefox User-Agent string for Windows 10: '95.0', os: :windows, os_version: 10)
# => "Mozilla/5.0 (Windows NT 10.0; rv:100.0.4758.81) Gecko/20100101 Firefox/95.0"

Get a random googlebot User-Agent string:

user_agent = Ronin::Web::UserAgents.google_bot.random
# => "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; GoogleBot/2.1; + Chrome/94.0.4602.7 Safari/537.36"

Spoof net/http's User-Agent string:

require 'net/https'

uri      = URI("")
headers  = {'User-Agent' =>}
response = Net::HTTP.get(uri,headers)


Spoof open-uri's User-Agent string:

require 'open-uri'

url       = ""
headers   = {'User-Agent' =>}
temp_file =,headers)

Spoof mechanize's User-Agent string:

require 'mechanize'

agent =
agent.user_agent =
page = agent.get("")

Spoof rest-client's User-Agent string:

require 'rest-client'

RestClient.get "",

Spoof curl's User-Agent string:

user_agent="$(ruby -r ronin/web/user_agents -e 'print')"

curl --user-agent "$user_agent"



$ gem install ronin-web-user_agents


gem 'ronin-web-user_agents', '~> 0.1'


gem.add_dependency 'ronin-web-user_agents', '~> 0.1'


  1. Fork It!
  2. Clone It!
  3. cd ronin-web-user_agents/
  4. bundle install
  5. git checkout -b my_feature
  6. Code It!
  7. bundle exec rake spec
  8. git push origin my_feature


Copyright (c) 2006-2023 Hal Brodigan (

ronin-web-user_agents is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

ronin-web-user_agents is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with ronin-web-user_agents. If not, see