Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


 <div class='header'>
   <h1><span class='noselect'>
     > <span class='blinker'>_</span>
   </span> Random Password Generator</h1>

<select class='btn btn-default pw-select'>
  <option val='0' selected disabled>Select password type</option>
  <option val='alpha'>Alpha Numeric</option>
  <option val='ascii'>ASCII</option>
  <option val='hex'>Hexadecimal</option>

<select class='btn btn-default pw-len'>
  <option val='0' selected disabled>Select length</option>
  <option val='4'>4-chars</option>
  <option val='6'>6 chars</option>
  <option val='8'>8 chars</option>
  <option val='10'>10 chars</option>
  <option val='12'>12 chars</option>
  <option val='14'>14 chars</option>
  <option val='16'>16 chars</option>

<button class=' btn btn-success submit'>

<h2 class='pw'>
  <div class='password'>password</div>

<button class='btn btn-danger clip'>
  Copy To Clipboard


                body {
  text-align: center;
.header {
  font-family: 'Oswald';
.blinker { 
  animation-name: blinker;
  animation-iteration-count: infinite;
  animation-duration: 1s;
  display: inline-block;
body {
  background-color: #333;
  color: white;
h1 {
  text-transform: uppercase;
  margin: 20px;
select, button {
  font-family: 'Lato';
.pw {
  letter-spacing: .4em;
  font-family: monospace;
  maring-bottom: 30px;
@keyframes blinker { 
  from { opacity: 1.0; } to { opacity: 0.0; }



                # PW Types
pwType = null
len = null
charset = null

# Charsets except ascii
charset_alpha = 
  'abcdefghijklnopqrstuvwxyz' + 
charset_hex = '0123456789ABCDEF'

# Select a password type
$('.pw-select').on 'click', ->
  pwType = $(".pw-select option:selected" ).attr('val')

# Select length
$('.pw-len').on 'click', ->
  len = $(".pw-len option:selected" ).attr('val')

# Submit request for password
$('.submit').click ->
  if (pwType == 'alpha')
    charset = charset_alpha
  if (pwType == 'hex')
    charset = charset_hex
  if (pwType == 'ascii')

# Copy to clipboard 
$('.clip').on 'click', ->

# Generate an alpha numeric or hex pw
generatePwd = (length) ->
  retVal = ''
  i = 0
  n = charset.length
  while i < length
    retVal += charset.charAt(Math.floor(Math.random() * n))
  if (retVal != '')

# Generate an ascii pw
generateAsciiPwd = (length) ->
  retVal = ''
  i = 0
  offset = 33
  n = 92 
  while i < length
    random =  Math.floor(Math.random() *n)
    retVal += String.fromCharCode(random+offset)
  if (retVal != '')

# Copies the password to an alert so that
# the user can copy it. This is the most
# secure way I can think to do it. 
copy = (text) ->
  window.prompt 'Copy to clipboard: Ctrl+C, Enter', text
# Prompt blinking cursor animation
$('.prompt').css 'animation', 
'blinker 1.5s ease-in-out infinite'