Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

Behavior

Save Automatically?

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.

HTML

              
                <div class="wrapper">
  <div class="a">
    <div class="configurar">
      <span class="tipo-config">Padrão</span>
      <select id="formatacao" name="formato" onclick="gtag('event','click',{'event_category':'app','event_label':'formatoCPF','value':1});">
				<option value="padrao" selected="selected">xxx.xxx.xxx-xx</option>
				<option value="digits">xxxxxxxxxxx</option>
				<option value="checker">xxxxxxxxx-xx</option>
			</select>
    </div>
    <div class="configurar">
      <span class="tipo-config">Origem</span>
      <select id="origem" name="origem" onclick="gtag('event','click',{'event_category':'app','event_label':'origemCPF','value':1});">
				<option value="none" selected="selected">Aleatório</option>
				<option value="2">AC</option>
				<option value="4">AL</option>
				<option value="2">AM</option>
				<option value="2">AP</option>
				<option value="5">BA</option>
				<option value="3">CE</option>
				<option value="1">DF</option>
				<option value="7">ES</option>
				<option value="1">GO</option>
				<option value="3">MA</option>
				<option value="6">MG</option>
				<option value="1">MS</option>
				<option value="1">MT</option>
				<option value="2">PA</option>
				<option value="4">PB</option>
				<option value="4">PE</option>
				<option value="3">PI</option>
				<option value="9">PR</option>
				<option value="7">RJ</option>
				<option value="4">RN</option>
				<option value="2">RO</option>
				<option value="2">RR</option>
				<option value="0">RS</option>
				<option value="9">SC</option>
				<option value="5">SE</option>
				<option value="8">SP</option>
				<option value="1">TO</option>
			</select>
    </div>
    <div class="configurar">
      <span class="tipo-config">Quant.</span>
      <input id="quantidade" class="quantidade" type="text" value="1" onclick="gtag('event','click',{'event_category':'app','event_label':'quantCPF','value':1});">
    </div>
  </div>
  <div class="d">
    <button class="generator" id="btn-gerar-CPF">Gerar CPF</button>
    <button class="generator" id="btn-validar-CPF">Validar CPF</button>
    <button class="generator" id="btn-copiar">Copiar</button>
  </div>
  <div class="e">
    <textarea id="cpf-gerado" class="resultado" name="resultado" cols="40" rows="5"></textarea>
  </div>
  <div class="f">De uma olhada em nosso
    <a href="https://ogeradordecpf.com.br/">site (ogeradordecpf.com.br)</a> e aprenda mais sobre como utilizar esta ferramenta no desenvolvimento de seus aplicativos web. Poderá aprender como fazer a programação em JS, PHP assim como validar um número de CPF em Excel utilizando VBA.
  </div>
  <div class="g">
  </div>
</div>

              
            
!

CSS

              
                
button.generator {
    margin-top: 10px;
    margin-bottom: 10px
}

.wrapper button {
    border-radius: 5px;
    padding: 10px 16px;
    margin: 0;
    color: #fff;
    &:hover,:focus {
        background-color: #303F9F;
        cursor: pointer;
    }
}

.tipo-config {
    display: block;
}

.configurar {
    display: inline-block;

    input,select {
        border-radius: 3px;
        height: 35px;
        max-width: 100%;
        margin-top: 0 !important 
    }
}

.configurar:not(:last-child) {
    margin-right: 5px
}

.quantidade {
    width: 50px
}


.wrapper {
    display: grid;
    grid-gap: 10px;
    grid-template:
        "a"
        "d"
        "e"
        "g"
        "f";
        /* grid-template-columns: repeat(3, 1fr); */
}

.a {
    /* grid-column: 1 / span 3;
    grid-row: 1; */
    grid-area: a
}

.d {
    /* grid-column: 1 / span 3;
    grid-row: 2; */
    grid-area: d;
    margin-top: 0 !important
}

.e {
    /* grid-column: 1 / span 3;
    grid-row: 3; */
    grid-area: e
}

.f {
    /* grid-column: 1 / span 3;
    grid-row: 4; */
    grid-area: f
}

.g {
    /* grid-column: 1 / span 3;
    grid-row-start: 3; */
    justify-self: center;
    grid-area: g;
    width: 100%;
    height: 100%;
    /* width: 250px;
    height: 200px;
    background-color: red */
}

@media (min-width:589px) {
    .wrapper {
        display: grid;
        grid-gap: 10px;
        grid-template-columns: repeat(3, 1fr) 3fr;
    }

    .a {
        grid-column: 1 / span 3;
        grid-row: 1;
    }

    .d {
        grid-column: 1 / span 3;
        grid-row: 2;
    }

    .e {
        grid-column: 1 / span 3;
        grid-row: 3;
    }

    .f {
        grid-column: 1 / span 3;
        grid-row: 4;
    }

    .g {
        grid-column: 4;
        grid-row-start: span 4;
        padding: 1.25rem
    }
}
              
            
!

JS

              
                "use strict";
var _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
  return typeof e
} : function(e) {
  return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e
};
! function() {
  var e = "object" === ("undefined" == typeof self ? "undefined" : _typeof(self)) && self.self === self && self || "object" === ("undefined" == typeof global ? "undefined" : _typeof(global)) && global.global === global && global || this,
    t = function() {};
  "undefined" == typeof exports || exports.nodeType ? e.CPF = t : ("undefined" != typeof module && !module.nodeType && module.exports && (exports = module.exports = t), exports.CPF = t);
  var r = function(e) {
      for (var t = null, r = 0; r < 9; ++r) t += e.toString().charAt(r) * (10 - r);
      var o = t % 11;
      return o < 2 ? 0 : 11 - o
    },
    o = function(e) {
      for (var t = null, r = 0; r < 10; ++r) t += e.toString().charAt(r) * (11 - r);
      var o = t % 11;
      return o < 2 ? 0 : 11 - o
    },
    n = function(e, t) {
      var r = ".",
        o = "-";
      return "digits" === t ? (r = "", o = "") : "checker" === t && (r = "", o = "-"), e.length > 11 ? "The value contains error. Has more than 11 digits." : e.length < 11 ? "The value contains error. Has fewer than 11 digits." : e.slice(0, 3) + r + e.slice(3, 6) + r + e.slice(6, 9) + o + e.slice(9, 11)
    };
  t.generate = function(e) {
    for (var t = "", f = 0; f < 9; ++f) t += String(Math.floor(10 * Math.random()));
    var i = r(t),
      l = t + i + o(t + i);
    return n(l, e)
  }, t.validate = function(e) {
    if (e && !0 !== e) {
      "number" == typeof e && (e = String(e));
      var t = e.replace(/[^\d]/g, ""),
        n = t.substring(0, 9),
        f = t.substring(9, 11);
      if (11 !== t.length) return !1;
      for (var i = 0; i < 10; i++)
        if ("" + n + f === Array(12).join(i)) return !1;
      var l = r(n),
        a = o("" + n + l);
      return f.toString() === l.toString() + a.toString()
    }
  }, t.format = function(e, t) {
    if (e) {
      var r = e.replace(/[^\d]/g, "");
      return n(r, t)
    }
  }
}();
document.getElementById("btn-gerar-CPF").onclick = function() {
  var e = document.getElementById("formatacao").value,
    t = document.getElementById("origem").value,
    a = (CPF.format(CPF.generate(), e), document.getElementById("quantidade").value),
    n = document.getElementById("cpf-gerado");
  if ("none" == t) {
    for (var r = CPF.format(CPF.generate(), e), o = 1; o < a; ++o) r += "\n" + CPF.format(CPF.generate(), e);
    n.value = r
  } else ! function r() {
    var o = CPF.format(CPF.generate(), "digits"),
      m = (o + "").charAt(8);
    if (m == t && 1 == a) n.value = CPF.format(o, e);
    else if (m == t && a > 1)
      for (var f = "", d = 0; d < a; ++d) ! function r() {
        var o = CPF.format(CPF.generate(), "digits");
        (o + "").charAt(8) == t ? (f += d < a - 1 ? CPF.format(o, e) + "\n" : CPF.format(o, e), n.value = f) : r()
      }();
    else r()
  }();
};
document.getElementById("btn-validar-CPF").onclick = function() {
  for (var e = document.getElementById("cpf-gerado").value.split("\n"), t = "", n = 0; n < e.length; n++) {
    var l = "❌";
    !0 === CPF.validate(e[n]) && (l = "✔"), n + 1 !== e.length ? t += e[n] + " - " + l + "\n" : t += e[n] + " - " + l, document.getElementById("cpf-gerado").value = t
  };
};
document.getElementById("btn-copiar").onclick = function() {
  document.getElementById("cpf-gerado").select(), document.execCommand("copy"), document.getElementById("btn-copiar").innerText = "Copiado!", setTimeout(function() {
    document.getElementById("btn-copiar").innerText = "Copiar"
  }, 1e3);
};

              
            
!
999px

Console