17 online now
Customer reviews
Customers using it now
★★★★★
4,8 · 1.263+ average rating
Verified customer
Leave a review
Need help?

Talk to our team on WhatsApp and we will help you move forward.

💬
Minike Tools Banner

Number Base Converter

Number Base Converter

Convert numbers between binary, octal, decimal and hexadecimal.

Gratis ate 10 MB por arquivo100 MB por enviosem anuncio antes do limite
$titulo = 'Conversor de Bases Numéricas'; $descricao = 'Converta números entre diferentes bases: binário (2), octal (8), decimal (10) e hexadecimal (16)'; $palavrasChave = 'conversor bases, binário, hexadecimal, octal, decimal'; $numero = ''; $base_origem = 'decimal'; $base_destino = 'binario'; $resultado = ''; $erro = ''; if ($_SERVER['REQUEST_METHOD'] === 'POST') { $numero = trim($_POST['numero'] ?? ''); $base_origem = $_POST['base_origem'] ?? 'decimal'; $base_destino = $_POST['base_destino'] ?? 'binario'; if (!empty($numero)) { $resultado = converterBase($numero, $base_origem, $base_destino); if ($resultado === false) { $erro = 'Número inválido para a base selecionada!'; $resultado = ''; } } } function validarNumeroBase($numero, $base) { $numero = strtoupper($numero); $digitos_validos = [ 'binario' => '01', 'octal' => '01234567', 'decimal' => '0123456789', 'hexadecimal' => '0123456789ABCDEF' ]; if (!isset($digitos_validos[$base])) { return false; } for ($i = 0; $i < strlen($numero); $i++) { if (strpos($digitos_validos[$base], $numero[$i]) === false) { return false; } } return true; } function converterBase($numero, $origem, $destino) { if (!validarNumeroBase($numero, $origem)) { return false; } // Primeiro converte para decimal $decimal = 0; $numero = strtoupper($numero); switch ($origem) { case 'binario': $decimal = bindec($numero); break; case 'octal': $decimal = octdec($numero); break; case 'decimal': $decimal = intval($numero); break; case 'hexadecimal': $decimal = hexdec($numero); break; } // Depois converte do decimal para a base destino switch ($destino) { case 'binario': return decbin($decimal); case 'octal': return decoct($decimal); case 'decimal': return $decimal; case 'hexadecimal': return strtoupper(dechex($decimal)); } return ''; } function formatarResultado($resultado, $base) { if ($base === 'hexadecimal') { return '0x' . $resultado; } elseif ($base === 'binario') { // Agrupar em grupos de 4 bits $resultado = str_pad($resultado, ceil(strlen($resultado) / 4) * 4, '0', STR_PAD_LEFT); return chunk_split($resultado, 4, ' '); } elseif ($base === 'octal') { return '0' . $resultado; } return $resultado; } ?> - Minike Ferramentas

Binário (Base 2)

Apenas 0 e 1

1010 = 10
Octal (Base 8)

Dígitos 0-7

012 = 10
Decimal (Base 10)

Dígitos 0-9

10 = 10
Hexadecimal (Base 16)

0-9, A-F

0xA = 10
Recommended next step

Keep this result working for you

Minike connects the tool you are using with the product most likely to generate recurring value.

Prices shown for Brazil and US positioning. Current local checkout charges BRL until the international gateway is enabled.
Share this tool
✓ Link copiado!