Encoding desk

Decimal to Octal

Convert a signed decimal integer to octal with no floating-point loss.

Decimal to Octal: Convert a decimal integer into digits from 0 to 7. Decimal to Octal shows the base-eight representation of the whole magnitude, with an explicit minus sign when needed. It can help compare a decimal value from a program with octal notation in a specification, without adding language-specific prefixes. Runs 100% locally in your browser with zero server file uploads.

Runs
In your browser
Cost
Free · no sign-up
Availability
Ready to use
Decimal → Octal / local workbenchLocal processing

Runs entirely in your browser

256 character input · 1,024 character output

Result

Ready

Conversions run locally. Numeric values are integers, signs are normalized, and prefixes such as 0b or 0o are intentionally not accepted.

Divide by eight, then reverse the digits

Let q be the non-negative magnitude. Each step takes quotient q_next = floor(q / 8) and remainder r = q − 8×q_next. Input 493 gives 493 = 8×61 + 5, 61 = 8×7 + 5, and 7 = 8×0 + 7. Reading the remainders 5, 5, 7 backwards produces 755. Checking 7×64 + 5×8 + 5×1 gives 448 + 40 + 5 = 493. The calculation treats the value as an integer rather than assigning permission meanings to the output digits.

Exact values and destination formats

Input permits one sign and decimal digits only, within 256 characters; output has a 1,024-character maximum. No decimal point, exponent, digit separators or rounding is supported. The converter remains exact above JavaScript Number’s safe integer boundary (https://tc39.es/ecma262/multipage/numbers-and-dates.html#sec-number.max_safe_integer), which is 2^53 − 1. A receiving Number-based parser may lose precision even though the octal text is correct. RFC 8259 (https://www.rfc-editor.org/rfc/rfc8259) defines JSON numbers without octal prefixes; send a labelled string or a correctly converted decimal when moving this notation into JSON.

How to use it

  1. Enter the value in the format shown below.
  2. Run the conversion and check the result against your source convention.
  3. Copy or download the output in the form required by your destination.

Privacy & limitations

Conversion runs in your browser. Your values and results are not uploaded.

Related tools

Frequently asked questions

Why does decimal 755 not give the familiar octal 755?

The decimal field means base ten. Entering 755 converts that magnitude to 1363 in octal. If 755 was already an octal permission code, use Octal to Decimal instead. Writing familiar digits in the wrong source-base field changes their value, even though the text looks plausible.

Are leading zeros or 0o added for use in code?

No. The result is the shortest sequence of octal digits. Add your language’s required marker only after checking its syntax. JSON numeric literals use decimal notation, so an octal-looking unquoted sequence there is still read as decimal; preserve it as a string when notation itself matters.

Does a negative decimal become a fixed-width octal bit pattern?

It keeps a minus sign. The output is not a masked signed machine word. To represent a negative integer as two’s complement, choose its bit width, check the signed range and convert the corresponding unsigned magnitude separately. Extra padding and storage byte order belong to the target format.

Free tool · runs in your browser · no account required